简体   繁体   中英

JSP file not using CSS because of web.xml

I've had this simple jsp log-in form that used the css style sheet. It was working just fine until I included the web.xml file in my directory. Now the JSP file won't load the css files no matter what. I've tried changing the link address of the css in multiple different ways but with no luck.

I'm pretty positive that the web.xml file is the reason it's not loading because if I remove it, everything works again.

Here's my project structure:

在此处输入图片说明

Here's my login.jsp:

在此处输入图片说明

here's my web.xml: 在此处输入图片说明

Your web.xml includes /* in a security constraint, limiting access to all content of your application to those users with the role users . This means that, instead of serving your CSS file as requested to the browser, tomcat will redirect to the login.jsp as well (which is obviously an incorrect and not very stylish stylesheet)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM