java - 支柱错误: The requested resource is not available

标签 java struts2

需要帮助运行示例 struts 程序,它抛出“请求的资源不可用”错误。

我使用的是 struts-2.3.24.1 和 Tomcat 8。

The Project structure

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>SampleStruts</display-name>
      <welcome-file-list>
        <welcome-file>login.jsp</welcome-file>
      </welcome-file-list>

       <filter>
          <filter-name>struts2</filter-name>
          <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
       </filter>

       <filter-mapping>
          <filter-name>struts2</filter-name>
          <url-pattern>/*</url-pattern>
       </filter-mapping>

    </web-app>

struts.xml

 <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
       "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
       "http://struts.apache.org/dtds/struts-2.0.dtd">

       <struts>
          <constant name="struts.devMode" value="true" />
          <package name="default" namespace="/" extends="struts-default">
            <action name="login" class="com.sr.actions.LoginAction" >
                <result name="success"> /welcome.jsp </result>
                <result name="failed"> /failed.jsp </result>
            </action>
       </package>

       </struts>

请告诉我如何解决该问题。

最佳答案

库依赖关系不一致是依赖管理中最常见的错误。您的项目依赖项中没有重要的库。

需要 commons-lang3-3.1.jar 来解决错误。

查看如何Create Struts application using Maven .

关于java - 支柱错误: The requested resource is not available,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35516977/

相关文章:

java - 使用递归回溯查找有向图中的所有循环

struts2 - 如何使用参数重定向

java - 更改网络后如何解决 'Cannot create PoolableConnectionFactory'异常?

struts2 - 从 Struts2 中的 hashmap 获取变量值

java - 将字符串压入堆栈<E>

java - 将自定义信息添加到 JBehave HTML 报告

java - 客户端验证无法使用 validate()

java - Struts 2 默认页面

java - WAR 文件在 Tomcat 服务器中抛出 OutOfMemoryError

java - 从 JSlider 的值更改 JLabel 的值