I'm working on an activity and came across with this problem. The css won't work in my jsp.
Here is the structure of my project:
I tried applying css on my index.jsp Here:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../css/wpstyles.css" rel="stylesheet" type="text/css"/>
<title>Welcome!</title>
</head>
<body>
<a href="login">Login Here</a>
</body>
</html>
and in my wpstyles.css is just this:
body{
background: #6699ff;
color: #ff3366;
}
But for some reason it won't work. I also tried using the solution provided here: JSP doesn't see css
I also tried using the :
<link href="${pageContext.request.contextPath}/../css/wpstyles.css" rel="stylesheet" type="text/css"/>
or
<link href="${pageContext.request.contextPath}/css/wpstyles.css" rel="stylesheet" type="text/css"/>
but still doesn't work.
Please help. Thank you.
Here is the rendered index.jsp using the <link href="${pageContext.request.contextPath}/css/wpstyles.css" rel="stylesheet" type="text/css"/>
:
and here is the rendered index.jsp using the <link href="../css/wpstyles.css" rel="stylesheet" type="text/css"/>
: