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

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

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

        <tfoot id='QYvVc'></tfoot>

        资源在 Struts 2 中不可用

        Resource not available in Struts 2(资源在 Struts 2 中不可用)

          <bdo id='D0zPb'></bdo><ul id='D0zPb'></ul>

              • <tfoot id='D0zPb'></tfoot>

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

                  本文介绍了资源在 Struts 2 中不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是 Struts 新手,我想执行 HelloWorld 程序,但在 web 中编写 <filter> 标记后,我立即收到请求的资源不可用"错误.xml.

                  I am new to Struts and I want to execute HelloWorld program, but I am getting "Requested resource not available" error as soon as I write a <filter> tag in web.xml.

                  web.xml:

                      <?xml version="1.0" encoding="UTF-8"?>
                  <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xmlns="http://java.sun.com/xml/ns/javaee" 
                     xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                     http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                     id="WebApp_ID" version="2.5">
                  
                     <display-name>Struts 2</display-name>
                     <welcome-file-list>
                        <welcome-file>index.jsp</welcome-file>
                     </welcome-file-list>
                  
                     <filter>
                        <filter-name>struts2</filter-name>
                        <filter-class>
                           org.apache.struts2.dispatcher.FilterDispatcher
                        </filter-class>
                     </filter>
                  
                     <filter-mapping>
                        <filter-name>struts2</filter-name>
                        <url-pattern>/*</url-pattern>
                     </filter-mapping>
                  </web-app>
                  

                  struts.xml :

                  struts.xml :

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE struts PUBLIC
                     "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
                     "http://struts.apache.org/dtds/struts-2.3.dtd">
                  <struts>
                     <package name="helloworld" extends="struts-default">
                        <action name="hello" class="sagar.practice.HelloWorldAction" method="execute">
                              <result name="success">/HelloWorld.jsp</result>
                        </action>
                     </package>
                  </struts>
                  

                  我将所有必需的 struts jar 添加为用户库.

                  I added all required struts jars as a user library.

                  我正在访问索引页面:http://localhost:8080/practice/index.jsp

                  如果我从 web.xml 文件中删除 <filter> 标记,我可以访问 index.jsp 页面,但如果我添加<filter> 标记它给出请求的资源不可用"错误.

                  If I remove <filter> tag from web.xml file I am able access index.jsp page, but if I add <filter> tag it is giving "Requested resource not available" error.

                  推荐答案

                  您应该通过在 struts.xml 中设置一个常量来打开 devMode.如果您想解决像您这样的问题,则使用此模式.它的信息量更大,因为它输出到在正常模式下隐藏的控制台错误.

                  You should turn on devMode on via setting a constant in the struts.xml. This mode is used if you want to troubleshot some issues like yours. It's more informative because it outputs to the console errors that are hidden in the normal mode.

                  <constant name="struts.devMode" value="true" />  
                  

                  打开它后,您可能会发现您的应用程序部署了错误或不一致的库集.您可能会发现 java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils 打印到控制台,然后调整缺少 jar 的库集.

                  After turning it on you may discover that you have wrong or inconsistent library set deployed with your application. You might find a java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils printed to the console, then adjust your library set with missing jars.

                  commons-lang3-3.1.jar 是解决错误所必需的.

                  The commons-lang3-3.1.jar is required to resolve error.

                  这篇关于资源在 Struts 2 中不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Java Bytecode Manipulation Library Suggestions(Java 字节码操作库建议)
                  Java CLI UI-design: frameworks or libraries?(Java CLI UI 设计:框架还是库?)
                  About the use of Beans.xml configuration file in Spring Framework application(关于Spring Framework应用中Beans.xml配置文件的使用)
                  What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?(Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?)
                  Are there any android application framework like spring?(有没有像spring这样的android应用程序框架?)
                  Java Swing based game framework. Any advice?(基于 Java Swing 的游戏框架.有什么建议吗?)
                    <bdo id='rgyss'></bdo><ul id='rgyss'></ul>
                    1. <small id='rgyss'></small><noframes id='rgyss'>

                        <tbody id='rgyss'></tbody>

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