File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes stylesheets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "stylesheets" Watch "stylesheets" New topic


rahul karwal
Ranch Hand

Joined: Oct 26, 2001
Posts: 73
how to do u import stylesheets using struts costom tags? i have tried alot but i hava failed to get my stylesheets to work using struts tags, any help will be apprecitated, an example would really help.
my directory structure is as follow:-
------------------ for stylesheeets-------------------------------------
|___ myStyleSheets.css

------------------------- my JSP page--------------------------------

|___ myJSPPage.jsp


aziz dhanani.
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Struts custom tags have nothing to do with whether you use CSS stylesheets or not -- or where the browser should look for them.

Now, if you have a JSP file under /jsp/MyPage.jsp, it should refer to a stylesheet under /css/MyStyle.css with
<link rel="stylesheet" type="text/css" href="../css/MyStyle.css">

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
M Murthy
Ranch Hand

Joined: Nov 20, 2004
Posts: 33
Adding to Lasse 's :

once you have defined <link ....
you can customize your struts tags by setting the styleClass attribute to a
css class.


If you have defined a class as below in your css file

.SmallBoldText { font: bold 10px Verdana; }


<html:submit property="someName" styleClass="SmallBoldText">

Hope this helps

Sindhu Murthy<br />SCJP 1.4<br />SCBCD
I agree. Here's the link:
subject: stylesheets
It's not a secret anymore!