File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[SOLVED] CSS not being applied to my JSF?

 
Marco Di Baggio
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • 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

 
Duc Vo
Ranch Hand
Posts: 254
  • 0
  • Mark post as helpful
  • send pies
  • 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: 35
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic