• 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

[SOLVED] CSS not being applied to my JSF?

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

This is my first post, so I apologize in advance if this is a trivial question.

Simply put, I have created a JSF (WAR project) to test out some css concepts. I am attemping to include my css file in my JSF/JSP file but whenever I try to render the JPS page, the css rules are not being applied.
It would appear as though the project cannot find/apply the css file (at least this is what I believe is the case.

Here is some background information:

/********************
* JSF Project structure:
********************/
WebContent /
META-INF
Pages
----> .jsp/jsf files etc
Pictures
----> jpeps, images etc
Style
----> FormStyle.css
WEB-INF
----> faces-config.xml
----> geronimo-web.xml
----> web.xml
/******************************************************
* Example.jsp -- to show how I reference the css file in my jsp's
******************************************************/


/*********************
* FormStyle.css
**********************/


Again, this is a local project that I am running on my laptop to simply practice/refine some css priciples. So again this is run locally using:

1. WAS CE - websphere community edition
2. Eclipse IDE

Also it may be important to note that the JSF/JSP page is accessed through this URL path:

http://localhost:8080/ProjectName/faces/Pages/Example.jsp

Please note the *faces* in the url path.

I hope that someone can confirm that this is simply a css referencing error?
Thanks again

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

Marco Di Baggio wrote:
<link rel=stylesheet" href="/Style/FormStyle.css" type="text/css">


You need to have project name there (i.e. /ProjectName/Style/FormStyle.css). This is a standard HTML tag, hence the root directory isn't your project directory but the domain root.
 
Marco Di Baggio
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,

Much appreciated. I resolved this issue by using:



Which appears to fill in the appropriate "project name" when reviewing the web page source code.
Post has been updated to "Resolved"
Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic