muthiahmerchant
asked on
struts problem determining the location of css file.
I have a small struts application. I am having difficutlies get to my css file using the following.
<link rel="STYLESHEET" TYPE="text/css" href="/css/styles.css" >
what should i put in the href. My styles.css is located in project/WEB/css
how do i determine the relative path.
Thanks
<link rel="STYLESHEET" TYPE="text/css" href="/css/styles.css" >
what should i put in the href. My styles.css is located in project/WEB/css
how do i determine the relative path.
Thanks
but if you define href like "/css/style.css" that mean it is absolute path and you have to put .css file in root folder.
ASKER
the problem is I am using struts and the urls to access struts does not represent the actual location of the jsp file
for example to go to the login page I use http://localhost/project/login.do, but login.jsp resides in project/web/jsp/login.jsp
hence i think my relative path should not be with respect to the url. is there any other way.
Thanks for your help
for example to go to the login page I use http://localhost/project/login.do, but login.jsp resides in project/web/jsp/login.jsp
hence i think my relative path should not be with respect to the url. is there any other way.
Thanks for your help
Is this CSS called from login.jsp?
Try to use this as well
<link rel="STYLESHEET" TYPE="text/css" href="css/styles.css" >
David
Try to use this as well
<link rel="STYLESHEET" TYPE="text/css" href="css/styles.css" >
David
ASKER
The css is called from another file which is part of struts tiles
> the problem is I am using struts and the urls to access struts does not represent the actual location of the jsp file
use the base tag to specify the base url for your pages
http://www.w3schools.com/tags/tag_base.asp
use the base tag to specify the base url for your pages
http://www.w3schools.com/tags/tag_base.asp
or try to use this one.
href="<%=request.getContex tPath%>/we b/css/styl e.css"
href="<%=request.getContex
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks to all your comments.
since I am using struts I will go with the boonleng's solution.
Thanks again
since I am using struts I will go with the boonleng's solution.
Thanks again
It's relative path to you jsp or html file.
If you jsp/html put in project/WEB and your .css put in project/WEB/css,
so href should be href="./css/styles.css"
sompol