cofactor
asked on
How to link css file in JSP ?
In Eclipse Web Project I have files:
WebContent\css\style.css
WebContent\pages\life\life .jsp
How do I link style.css in life.jsp ?
This does NOT work.
<link href="css\styles.css" type="text/css" rel="stylesheet">
Could you please suggest how do I link correctly ?
WebContent\css\style.css
WebContent\pages\life\life
How do I link style.css in life.jsp ?
This does NOT work.
<link href="css\styles.css" type="text/css" rel="stylesheet">
Could you please suggest how do I link correctly ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<link rel="stylesheet" type="text/css" href="/ur Project name/css/styles.css" />
or
<link href="css/styles.css" type="text/css" rel="stylesheet">
ur mistake is backslas change that \ into /
or
<link href="css/styles.css" type="text/css" rel="stylesheet">
ur mistake is backslas change that \ into /
ASKER
>>>ur mistake is backslas change that \ into /
No. This cant not work. You did not notice the folder structure closely.
No. This cant not work. You did not notice the folder structure closely.
ASKER
>>>/ur Project name
I dont want to put Project Name there.
I dont want to put Project Name there.
cofactor,
have u seen my coment
have u seen my coment
ASKER
>>>>have u seen my coment
Yes. I like relative path. But can in every page this costs two "/" and couple of dots. Can we make it more simpler ?
Yes. I like relative path. But can in every page this costs two "/" and couple of dots. Can we make it more simpler ?
then use contenttype
>>
No. This cant not work. You did not notice the folder structure closely.
Have you tried ? without tiring your saying ?
No. This cant not work. You did not notice the folder structure closely.
Have you tried ? without tiring your saying ?
ASKER
>>then use contenttype
not understood.
>>>Have you tried ? without tiring your saying ?
No. I said because jsp lies two folders down i.e ( "pages" , "life" ). and css is just under root . So that should not work.
Do you still say that will work. how come ?
not understood.
>>>Have you tried ? without tiring your saying ?
No. I said because jsp lies two folders down i.e ( "pages" , "life" ). and css is just under root . So that should not work.
Do you still say that will work. how come ?
without puting / infront of the any folder then application will directly check in root folder only
ASKER
>>>without puting / infront of the any folder then application will directly check in root folder only
I tried when it is in HTML ..this does not work.
Do you mean when I deploy in server as JSP, this will work ?
I tried when it is in HTML ..this does not work.
Do you mean when I deploy in server as JSP, this will work ?
ASKER
>>without puting / infront of the any folder then application will directly check in root folder only
>>Do you mean when I deploy in server as JSP, this will work ?
No..neither way ....it did not work even after deployment.
>>Do you mean when I deploy in server as JSP, this will work ?
No..neither way ....it did not work even after deployment.
ASKER
>>><link href="../../css/styles.css " type="text/css" rel="stylesheet">
This worked.
But not happy to see two many slas and dots .
This worked.
But not happy to see two many slas and dots .
check this:
http://stackoverflow.com/questions/6599254/include-a-css-file-as-inline-style-in-a-jsp
This sort of directive should work, but you will need to be sure of the path you're using:
<%@ include file="/path_to/your_css_fi