Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

java - struts error: The requested resource is not available

Need help in running the sample struts program, it is throwing "The requested resource is not available" error.

I am using struts-2.3.24.1 and 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>

Please let me know how to resolve the issue.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Inconsistent library dependencies most popular error in dependencies management. You don't have an important library in the project dependencies.

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

See how to Create Struts application using Maven.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...