开发者

A very strange problem -> CSS file not detected .Java web application

开发者 https://www.devze.com 2023-01-01 07:07 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消