A very strange problem -> CSS file not detected .Java web application
If i browse my site using http://localhost:8080/abc/Login/index.jsf
, everything works fine. But if browse it using simply http://localhost:8080/abc
, the page is shown but all its images and css files are missing. What can be the problem?
I have this in my web.xm开发者_开发知识库l :-
<form-login-config>
<form-login-page>/Login/index.jsf</form-login-page>
<form-error-page>/Login/index.jsf</form-error-page>
</form-login-config>
Probably, images are not getting referenced correctly. Can anybody help me?
I have referenced css file as follows :-
<link href="./Css/MainStyleSheet.css" rel="stylesheet" type="text/css" />
where Css is folder in Login
Your problem (as you guessed) comes from how you have referenced the CSS.
Probably the easiest way to fix it is to be more specific with your reference:
<link href="/abc/Login/Css/MainStyleSheet.css" rel="stylesheet" type="text/css" />
This reference should work regardless of where the calling file is in your directory structure.
精彩评论