This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I went through a Spring/Tiles/Hibernate tutorial and tried to adapt it to my purposes. The functionality within the application works. I am able to delete and insert records, display them on a form, etc. However, the layout page is not picking up my stylesheet. The stylesheet reference is correct. My jsps are located in the WEB-INF/jsp folder.
Part of my problem seems to be the url pattern I have defined in the web.xml, which is just "/".
This allows me to create request mappings of /index or /add or /delete.
Please let me know what other information I need to post to help dissect the problem.
I'm not sure what it means for a layout page to "pick up" a stylesheet. So I'm going to assume that you mean that when the result of all the Spring and Tiles business appears in your browser, it isn't styled according to the stylesheet you expected to be used. I'm also going to assume that the HTML which you see in the browser does actually contain a reference to that stylesheet.
Now remember that it's the browser that styles the HTML, not Spring or Tiles or JSP or anything on the server. And the browser has no idea what ran on the back end, all it knows is that it was given some HTML to work with.
So there are two possibilities: the reference to the stylesheet isn't correct, or it doesn't work. If you think you know the absolute URL of the stylesheet, you can type or paste that URL into your browser's address bar and see what comes back. If you do see a stylesheet when you do that, then that means the reference to the stylesheet in the HTML doesn't resolve to that absolute URL. Anyway that's the sort of testing you need to do.
Joined: Aug 31, 2009
When I change the url mapping to
I can't view the stylesheet with the absolute url.
However, when I change the url mapping to
Then I can...doesn't make sense.
Joined: Aug 31, 2009
This is how I solved this...I created a separate context, or application called "themes" in my Tomcat webapps directory. I put the css file in there.
Then from my spring application, I referred to the "themes" stylesheet in this matter...in my layout.jsp.