• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Facelets + CSS problem; CSS is not applied after first request

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In every page of my webapplication I'm using facelets layout page which includes a stylesheet. In order to include the stylesheet I've tried the following options:

Determining the absolute path using a JSF expression:
<link rel="stylesheet" type="text/css" href="#{facesContext.externalContext.request.contextPath}/theme/stylesheet.css" />

And by using the tomahawk stylesheet tag:
<t:stylesheet path="/theme/stylesheet.css" />

I'm using an index.jsp page which forwards to the first page of my webapplication using:
<jsp:forward page="shop/selectbicycle.jsf" />

However, I encounter the following problem:
When I access the index.jsp page it forwards to the selectbicycle.xhtml page and I see my page with the right layout. In other words, the CSS gets applied.
However, after the next requests to other facelets pages (*.jsf gets mapped to *.xhtml), the CSS is not applied to the pages.

Can anyone help me with this? Thanks a lot.

By the way, my layout page looks as follow:


[ April 19, 2007: Message edited by: Paul Speijers ]
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check the generated source code to see if the css path is correct.
 
Paul Speijers
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a good point which I forgot to mention, the generated CSS is correct.

<link rel="stylesheet" type="text/css" href="/BuyABike/theme/stylesheet.css" />

The weird thing is that the generated CSS is the same in the cases where the CSS is applied and when it isn't
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic