• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tiles not picking up stylesheet in Spring app

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Charles Owen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I change the url mapping to
[code]
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
[/code]

I can't view the stylesheet with the absolute url.

However, when I change the url mapping to
*.html

Then I can...doesn't make sense.
 
Charles Owen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

<link rel="stylesheet" href="/themes/styles.css" type="text/css" />

In the end, this was some type of routing issue. I still used the url-pattern of /

I'm not sure how I would have resolved this by keeping the themes directory in my own application.

 
Charles Owen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's entirely possible this had NOTHING to do with Spring, so my apologies.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic