CSS rules not getting applied in JSPs ?
Posted
by lakshmanan
on Stack Overflow
See other posts from Stack Overflow
or by lakshmanan
Published on 2010-03-08T17:33:04Z
Indexed on
2010/03/08
17:36 UTC
Read the original article
Hit count: 381
Im building a web application using struts2. I have an authentication interceptor at the top of all the interceptors (I have set it up as such) which checks whether a user is logged in. If not, it will give a login page as result.
In login page, I have some set of standard CSS rules which I use for all the JSPs in the app. But that login page coming via that interceptor is not getting applied with CSS rules. Don't know why. Here is my JSP login page.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="styles/styles.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Projit Login </title>
</head>
<body>
<div id="header">
<h1>Projit</h1>
</div>
<div id="col1">
<s:form action="/login.action">
<s:textfield name="some field" label="Enter somefield" />
<s:textfield name="username" label="Username" />
<s:password name="password" label="Password" />
<s:submit value="Sign In" />
</s:form>
</div>
<div id="col2">
<h3>Login</h3>
</div>
<div id="footer">
some footer
</div>
</body>
</html>
the css file is present in WebContent/styles/styles.css I am using eclipse for development. this problem of CSS rules not getting applied occurs at times for other jsps as well inspite of the CSS file being present in the correct location. I guess there must be some URL thing behind this problem. I have tried hard but it is not working till now. Please help.
© Stack Overflow or respective owner