Forums Login/signup

[SOLVED] CSS not being applied to my JSF?

+Pie Number of slices to send: Send
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

+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
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

reply
reply
This thread has been viewed 4152 times.
Similar Threads
JSF Navigation Issue
"#{...} is not allowed in template text" error
Problems of Deploying JSF war file to Tomcat
CSS : z-index: property not working
Cannot find FacesContext
More...

All times above are in ranch (not your local) time.
The current ranch time is
Jul 01, 2025 04:44:09.