• <i id='jV2mk'><tr id='jV2mk'><dt id='jV2mk'><q id='jV2mk'><span id='jV2mk'><b id='jV2mk'><form id='jV2mk'><ins id='jV2mk'></ins><ul id='jV2mk'></ul><sub id='jV2mk'></sub></form><legend id='jV2mk'></legend><bdo id='jV2mk'><pre id='jV2mk'><center id='jV2mk'></center></pre></bdo></b><th id='jV2mk'></th></span></q></dt></tr></i><div id='jV2mk'><tfoot id='jV2mk'></tfoot><dl id='jV2mk'><fieldset id='jV2mk'></fieldset></dl></div>
    <legend id='jV2mk'><style id='jV2mk'><dir id='jV2mk'><q id='jV2mk'></q></dir></style></legend>

    1. <small id='jV2mk'></small><noframes id='jV2mk'>

      <tfoot id='jV2mk'></tfoot>

          <bdo id='jV2mk'></bdo><ul id='jV2mk'></ul>
      1. 无法从 JSP 访问在 WEB-INF 下定义的 CSS 文件

        Cannot access CSS files defined under WEB-INF from JSP(无法从 JSP 访问在 WEB-INF 下定义的 CSS 文件)
                <tbody id='slf36'></tbody>

            1. <tfoot id='slf36'></tfoot>
              <i id='slf36'><tr id='slf36'><dt id='slf36'><q id='slf36'><span id='slf36'><b id='slf36'><form id='slf36'><ins id='slf36'></ins><ul id='slf36'></ul><sub id='slf36'></sub></form><legend id='slf36'></legend><bdo id='slf36'><pre id='slf36'><center id='slf36'></center></pre></bdo></b><th id='slf36'></th></span></q></dt></tr></i><div id='slf36'><tfoot id='slf36'></tfoot><dl id='slf36'><fieldset id='slf36'></fieldset></dl></div>
                <bdo id='slf36'></bdo><ul id='slf36'></ul>

                1. <legend id='slf36'><style id='slf36'><dir id='slf36'><q id='slf36'></q></dir></style></legend>

                  <small id='slf36'></small><noframes id='slf36'>

                2. 本文介绍了无法从 JSP 访问在 WEB-INF 下定义的 CSS 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经使用 Maven 创建了 Struts2 应用程序.在这个应用程序中,我创建了两个命名空间,第一个是 tc,第二个是 cmpui.从 JSP 页面,我试图访问 .css 文件,但它给了我 404 错误.

                  I have created Struts2 application using Maven. In this application I have created two namespaces, first is tc and the second one is cmpui. From the JSP page, I am trying to access .css files, but it is giving me 404 error.

                  JSP 页面的位置是:

                  Location of JSP page is :

                  webapp	clayoutstylesheets.jsp
                  

                  CSS 文件的位置是:

                  Location of CSS file is :

                  WEB-INFcssdefault.css
                  

                  JSP 页面上的代码是

                  Code on JSP page is

                  <link rel="stylesheet" type="text/css" href="../WEB-INF/css/default.css">
                  

                  请给点建议.

                  推荐答案

                  您无法访问 WEB-INF 文件夹下的资源.将您的静态资源移动到 Struts2 可访问的另一个位置(例如,Web 根目录).并使用 s:url 标签构建 URL.

                  You can not access a resources that are under WEB-INF folder. Move your static resources to another place accessible by Struts2 (for example, web root). And use s:url tag to build the URL.

                  <link rel="stylesheet" type="text/css" href="<s:url value='/css/default.css'/>">
                  

                  这篇关于无法从 JSP 访问在 WEB-INF 下定义的 CSS 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Compiling C++ for the JVM(为 JVM 编译 C++)
                  Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                  How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                  Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                  How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                  Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)
                  • <small id='cfLSQ'></small><noframes id='cfLSQ'>

                            <tbody id='cfLSQ'></tbody>
                        1. <tfoot id='cfLSQ'></tfoot>
                          <i id='cfLSQ'><tr id='cfLSQ'><dt id='cfLSQ'><q id='cfLSQ'><span id='cfLSQ'><b id='cfLSQ'><form id='cfLSQ'><ins id='cfLSQ'></ins><ul id='cfLSQ'></ul><sub id='cfLSQ'></sub></form><legend id='cfLSQ'></legend><bdo id='cfLSQ'><pre id='cfLSQ'><center id='cfLSQ'></center></pre></bdo></b><th id='cfLSQ'></th></span></q></dt></tr></i><div id='cfLSQ'><tfoot id='cfLSQ'></tfoot><dl id='cfLSQ'><fieldset id='cfLSQ'></fieldset></dl></div>
                            <bdo id='cfLSQ'></bdo><ul id='cfLSQ'></ul>

                            <legend id='cfLSQ'><style id='cfLSQ'><dir id='cfLSQ'><q id='cfLSQ'></q></dir></style></legend>