PDA

View Full Version : How can i use resources like css or java script in a JSP-view (Spring 3 Portlet MVC)



Alex66955
Jun 4th, 2012, 10:34 AM
Hey,

I develop a portlet application on Websphere 7. And I use the Spring 3.1 MVC-Portlet framework.

Everything is fine except the css includes.

JSP-File:
4944

I put the css directory on the root path. Because i know the the WEB-INF directory is not readable (public perspective).

In the jsp file i have to set the css path.


<link rel="stylesheet" type="text/css" href="/css/formular.css" /> -->????



Is that all?
I get the follow server response:


"A WebGroup/Virtual Host to handle /css/formular.css has not been defined."


How can i fix it?


Thanks
Alex

Alex66955
Jun 5th, 2012, 03:04 AM
The answer ist simple.

I just use this TAG in the jsp file:

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/formular.css" />

Make sure the css or java scripts are readable


ROOT
---CSS <-- readable
---JavaScript <-- readable
---WEB-INF <-- Not readable without special changes
---META-INF