aspose file tools*
The moose likes Struts and the fly likes Using external CSS file in JSP in struts 2 framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Using external CSS file in JSP in struts 2 framework" Watch "Using external CSS file in JSP in struts 2 framework" New topic
Author

Using external CSS file in JSP in struts 2 framework

Harish V Gupta
Ranch Hand

Joined: Dec 17, 2011
Posts: 37
Hi guys, using CSS in struts 2 is giving me really hard time. No error is being thrown but the CSS style is not being applied on the JSP's elements. Following is the code :
CSS Code :


JSP Code:
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Hi Harish,
This has little to do with struts but have you tried using tools like "firebug" from firefox. Have you verified the HTML code using view source after rendering?

Looking into the code what I could see is most probably the CSS file is not picked due to the href path
1. Why would you want to give a url value? why dont you give it directly something like2.Verify where if the css file is located in the right place as mentioned.



Have Fun with Java
little,little.. little by little makes a lot..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60997
    
  65

Why are there <style> elements in your CSS file?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Good point, for a moment I didn't see that
Harish V Gupta
Ranch Hand

Joined: Dec 17, 2011
Posts: 37
Thanks for the reply guys. As per your suggestion, I corrected the path name and I am using it as follows :


It's working fine but there is a new problem that I have come across. I have a validate method in my action class to validate one of the contents on my sign up page. On validation fail, the message is being shown on the the sign up page but css and javascript is not being applied. I checked using firebug and it's throwing error which says that resource is not found.
The directory structure is attached.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using external CSS file in JSP in struts 2 framework