Html Css、js和其他文件可以访问,但不应用于页面

Html Css、js和其他文件可以访问,但不应用于页面,html,jsp,tiles,Html,Jsp,Tiles,我为我的web应用程序制作了一个主题。 我在页面上包括了css、js和其他资产。然而,页面看起来好像没有任何css或任何其他类型的资产 我的主模板: <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w

我为我的web应用程序制作了一个主题。 我在页面上包括了css、js和其他资产。然而,页面看起来好像没有任何css或任何其他类型的资产

我的主模板:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        
        <link href="<c:url value="/resources/plugins/fullcalendar/fullcalendar.css"/>" rel="stylesheet" />
        <link href="<c:url value="/resources/plugins/fullcalendar/fullcalendar.print.css"/>" rel="stylesheet" media="print" />
        
        <!-- project css -->
        <link href="<c:url value="/resources/css/style.css"/>" rel="stylesheet" media="print" />
        
        <script src="<c:url value="/resources/lib/moment.min.js"/>"></script>
        <script src="<c:url value="/resources/lib/jquery.min.js"/>"></script>
        <script src="<c:url value="/resources/lib/jquery-ui.custom.min.js"/>"></script>
        <script src="<c:url value="/resources/plugins/fullcalendar/fullcalendar.min.js"/>"></script>

    </head>
        
    <body>

        <div id="wrapper">
           <tiles:insertAttribute name="main"/> 
           <tiles:insertAttribute name="footer"/>
        </div>      
    </body>
</html>

我主要插入以下内容:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<div id="container-login" class="absolute-center">
    <h2>Login</h2>

    <c:if test="${not empty error}">
        <div class="errorblock">
            Your login attempt was not successful, try again.<br /> Caused :
            ${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message}
        </div>
    </c:if>

    <form action="<c:url value='j_spring_security_check' />" method='POST'>

        <div class="form-group">
            <label for="username">Username:</label>
            <input type='text' name='j_username' value='' id="username"/>
        </div>

        <div class="form-group">
            <label for="password">Password:</label>
            <input type='password' name='j_password' value='' id="password"/>
        </div>

        <div class="form-group">
            <div class="checkbox">
                <label for="remember-me">Remember me</label>
                <input type="checkbox" id="remember-me" name="remember-me"/>
            </div>
        </div>

        <div class="form-group">
            <input name="submit" type="submit" value="Log in" />
        </div>
    </form>

    <script>
        $(window).resize(function() {

            $('.absolute-center').css({
                position: 'absolute',
                left: '50%',
                top: '50%',
                'margin-left': -$('#container-login').width() / 2,
                'margin-top': -$('#container-login').height() / 1.2


            });

        });
        // To initially run the function:
        $(window).resize();

        $('.field-validation-error, .alert').each(function() {
            $(this).addClass('animated fadeInDown');
        });
    </script>
</div>

登录
您的登录尝试未成功,请重试。
导致: ${sessionScope[“SPRING\u SECURITY\u LAST\u EXCEPTION”].message} 用户名: 密码: 记得我吗 $(窗口)。调整大小(函数(){ $('.absolute center').css({ 位置:'绝对', 左:50%, 前50%, “左边距”:-$(“#容器登录”).width()/2, “页边距顶部”:-$(“#容器登录”).height()/1.2 }); }); //要最初运行该函数,请执行以下操作: $(窗口).resize(); $('.field验证错误,.alert')。每个(函数(){ $(this.addClass('animated fadeInDown'); });
页脚只是一些文本

当我在Chrome中查看源代码时,我可以单击相应的文件。它不会抛出404,我可以正确地查看资源

我将Spring3.2.3与tiles一起使用

我的互动程序配置:

<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
       "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
 
<tiles-definitions>
     
    <definition name="base.plain" template="/WEB-INF/jsp/template/basePlain.jsp">
         <put-attribute name="footer" value="/WEB-INF/jsp/template/footer.jsp"/>
    </definition>
    
    <definition name="base.main" extends="base.plain">
         <put-attribute name="footer" value="/WEB-INF/jsp/template/footer.jsp"/>
         <put-attribute name="main" value="/WEB-INF/jsp/template/base.jsp"/>
    </definition>
     
     
    <definition name="screen.login" extends="base.plain">
        <put-attribute name="main" value="/WEB-INF/jsp/views/login.jsp" />
    </definition>
    
    <definition name="view.planning.viewPlanning" extends="base.main">        
        <put-attribute name="body" value="/WEB-INF/jsp/planning/viewPlanning.jsp"/>
    </definition>
    
</tiles-definitions>

结果是:

您可以使用
media=“print”
这会导致显示问题。
还解释了为什么chrome将其显示为合法来源。

以及rsulting标记是什么样子的?可能是因为没有经过身份验证的会话(未登录)而无法交付资产吗?我添加了一张我现在得到的结果图片。你在chrome、firefox或ie中的web开发工具怎么说?资产是否不仅已加载,而且还具有有效内容?控制台是空的,因此我假设每个资产都已正确交付。它还说资产是以家长身份交付的,我忘记了type=“text/css”解决了我的问题