File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes problem with css Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "problem with css" Watch "problem with css" New topic

problem with css

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 361
Hi i have following jsp code


css code

when the Login.jsp loads for the first time, the back ground color is not changed as in style sheet. But if i hit submit the color changes.....

can some one pls tell what mistake i am doing......I am making use of Tomcat 5.x

SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
Paul Clapham

Joined: Oct 14, 2005
Posts: 19850

I don't know what "hitting submit" means in the context of your application. But it is probably connecting to a URL for which the relative pathactually points to your CSS file, and your original URL does not do that.
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
<link href="../css/styles.css" rel="stylesheet" type="text/css"/>

try this instead:-

<link href="<%=request.getContextPath()%>/css/styles.css" rel="stylesheet" type="text/css"/>

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
I agree. Here's the link:
subject: problem with css
jQuery in Action, 3rd edition