Javascript 资源被解释为样式表,但使用MIME类型text/html传输。JSP

Javascript 资源被解释为样式表,但使用MIME类型text/html传输。JSP,javascript,java,html,css,jsp,Javascript,Java,Html,Css,Jsp,在将JAAS添加到动态Web项目中之后,我在JSP中的.css和.js文件出现了问题。我在所有页面都有这个错误。 我不明白,什么问题?在添加JAAS配置之前,一切都很好!但现在这是个问题。请帮忙! 这是我在Chrome中的错误。 这是我的login.jsp <%@ page pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ t

在将JAAS添加到动态Web项目中之后,我在JSP中的.css和.js文件出现了问题。我在所有页面都有这个错误。 我不明白,什么问题?在添加JAAS配置之前,一切都很好!但现在这是个问题。请帮忙! 这是我在Chrome中的错误。

这是我的login.jsp

    <%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="language"
    value="${not empty param.language ? param.language : not empty language ? language : pageContext.request.locale}"
    scope="session" />
<fmt:setLocale value="${language}" />
<fmt:setBundle basename="ua.khpi.shapoval.i18n.lang" />

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><fmt:message key="login.title" /></title>
<link href="<c:url value="/resources/bootstrap/bootstrap.min.css"/>"
    rel="stylesheet" type="text/css">
<link
    href="<c:url value="/resources/bootstrap/bootstrap-theme.min.css"/>"
    rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/css/styles.css"/>" rel="stylesheet"
    type="text/css">
<script type="text/javascript"
    src="<c:url value="/resources/Jquery/jquery-2.1.4.min.js"/>"></script>

</head>
<body>

    <div id="carousel-example-generic" class="carousel slide"
        data-ride="carousel">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            <li data-target="#carousel-example-generic" data-slide-to="0"
                class="active"></li>
            <li data-target="#carousel-example-generic" data-slide-to="1"></li>
            <li data-target="#carousel-example-generic" data-slide-to="2"></li>
        </ol>

        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
            <div class="item active">
                <img class="img-responsive center-block"
                    src="<c:url value="/resources/carouselPics/auto1.jpg"/>"
                    alt="Auto1">

            </div>
            <div class="item">
                <img class="img-responsive center-block"
                    src="<c:url value="/resources/carouselPics/auto2.jpg"/>"
                    alt="Auto2">

            </div>
            <div class="item">
                <img class="img-responsive center-block"
                    src="<c:url value="/resources/carouselPics/auto3.jpg"/>"
                    alt="Auto3">
            </div>

        </div>

        <a class="left carousel-control" href="#carousel-example-generic"
            role="button" data-slide="prev"> <span
            class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span
            class="sr-only">Previous</span>
        </a> <a class="right carousel-control" href="#carousel-example-generic"
            role="button" data-slide="next"> <span
            class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div>
    <div class="text-center">
        <h2>
            <strong><fmt:message key="login.motordepot" /></strong>
        </h2>
        <h3>
            <em><fmt:message key="login.welcometoautostation" /></em>
        </h3>

        <button type="button" class="btn btn-primary btn-lg"
            data-toggle="modal" data-target="#myModal">
            <fmt:message key="login.login" />
        </button>
    </div>



    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
        aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        <fmt:message key="login.login" />
                    </h4>
                </div>
                <div class="modal-body">
                    <div class="container">
                        <form method="POST" action="">
                            <div class="form-group col-md-4 text-center">
                                <label class="control-label"><fmt:message
                                        key="login.loginLabel" /></label> <input
                                    class="form-control input-sm" type="text" id="login"
                                    name="login" ng-model="login" required /> <label><fmt:message
                                        key="login.passwordLabel" /></label><input
                                    class="form-control input-sm" type="password" id="password"
                                    name="password" ng-model="password" required />
                            </div>
                        </form>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        <fmt:message key="login.close" />
                    </button>
                    <button type="button" class="btn btn-primary">
                        <fmt:message key="login.login" />
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="footer">
        <%@ include file="/fragments/footer.jspf"%>
    </div>


</body>
<script src="<c:url value="/resources/bootstrap/bootstrap.min.js"/>"
    type="text/javascript"></script>
<script src="<c:url value="/resources/Jquery/jquery-2.1.4.min.js"/>"
    type="text/javascript"></script>
</html>

  • " alt=“Auto1”> " alt=“Auto2”> " alt=“Auto3”> &时代;
    这里是带有JAAS配置的我的web.xml文件

      <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://xmlns.jcp.org/xml/ns/javaee"
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
        id="WebApp_ID" version="3.1">
        <display-name>Autostation</display-name>
        <welcome-file-list>
    
            <welcome-file>login.jsp</welcome-file>
    
        </welcome-file-list>
    
    
        <resource-ref>
    
            <description>Db</description>
    
            <res-ref-name>jdbc/autopark</res-ref-name>
    
            <res-type>javax.sql.DataSource</res-type>
    
            <res-auth>Container</res-auth>
    
        </resource-ref>
    
    
        <security-constraint>
            <web-resource-collection>
                <web-resource-name>ADMIN</web-resource-name>
                <url-pattern>/admin/*</url-pattern>
                <url-pattern>/*</url-pattern>
            </web-resource-collection>
            <auth-constraint>
                <role-name>ADMIN</role-name>
            </auth-constraint>
        </security-constraint>
    
        <security-constraint>
            <web-resource-collection>
                <web-resource-name>DRIVER, DISPATCHER</web-resource-name>
                <url-pattern>/</url-pattern>
                <url-pattern>/trips/*</url-pattern>
            </web-resource-collection>
            <auth-constraint>
                <role-name>ADMIN</role-name>
            </auth-constraint>
        </security-constraint>
    
        <security-role>
            <role-name>DRIVER</role-name>
        </security-role>
    
        <security-role>
            <role-name>DISPATCHER</role-name>
        </security-role>
    
        <security-role>
            <role-name>ADMIN</role-name>
        </security-role>
        <login-config>
            <auth-method>FORM</auth-method>
            <form-login-config>
                <form-login-page>/login.jsp</form-login-page>
                <form-error-page>/error.html</form-error-page>
            </form-login-config>
        </login-config>
    
        <session-config>
            <session-timeout>30</session-timeout>
        </session-config>
    
    
        <listener>
            <listener-class>ua.khpi.shapoval.listner.ContextListner</listener-class>
        </listener>
    </web-app>
    
    
    自动站
    login.jsp
    分贝
    jdbc/autopark
    javax.sql.DataSource
    容器
    管理
    /管理员/*
    /*
    管理
    司机、调度员
    /
    /旅行/*
    管理
    司机
    调度员
    管理
    形式
    /login.jsp
    /error.html
    30
    ua.khpi.Shapova.listner.ContextListner
    
    您试过这个了吗?