Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring 3 and Sitemesh integration

 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got a basic sitemesh example working with no problem (http://www.jforeach.com/learn-sitemesh-in-30-minutes-or-less/96), however, when I try to integrate that example with a simple Spring MVC 3 application, it's like the sitemesh stops obeying what's in the CSS file.

The pages do get decorated, but there is no style applied (color, layout, etc.).

The style sheet is in /WEB-INF/styles/style.css and I've tried to refer to it mostly using the full path like this, but also the same way it worked before I tried to integrate Spring, etc.

Not sure what the problem is getting these two technologies to work together.

Would appreciate any replies or suggestions.

Thanks.

- mike
 
Santhosh Kumar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi mike

Did you find the answer?.I am also facing the same problem.Any help would be appreciated.

 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Santhosh Kumar wrote:Hi mike

Did you find the answer?.I am also facing the same problem.Any help would be appreciated.



I believe you need to add this line to your Spring servlet.xml file:



Hope that helps.

-mike
 
dhoom dhoomm
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess you cannot access files from /WEB-INF/styles/* through browser, images, css files, etc are accessed through the browser.
You can take a view (.jsp, etc) from there as they are not directly accessed by the browser, but by the servlet engine. you have to place all publicly access-able files outside, eg. /resources/
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the Spring documentation here:
http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/mvc.html#mvc-config-static-resources

You can serve static resources using the following



Resources that need to be accessed like this should not be in WEB-INF
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic