【发布时间】:2014-06-09 03:38:03
【问题描述】:
我在 Tomcat 上运行我的 Struts 应用程序时遇到 The requested resource is not available 错误。
我的目录结构是:
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.3.dtd">
<struts>
<!-- remove these constant elements in production -->
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="app02a" namespace="" extends="struts-default">
<action name="Product_input">
<result>/jsp/Product.jsp</result>
</action>
<action name="Product_save" class="app02a.Product" method="execute">
<result>/jsp/Details.jsp</result>
</action>
</package>
</struts>
Web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<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>
<!-- Restrict direct access to JSPs.
For the security constraint to work, the auth-constraint
and login-config elements must be present -->
<security-constraint>
<web-resource-collection>
<web-resource-name>JSPs</web-resource-name>
<url-pattern>/jsp/*</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
注意:
1.我已将所有 jars 包含在 lib 文件夹中,并且它们位于构建路径中
2.我正在使用 struts-2.3.16.1
3.我正在尝试执行此网址
http://localhost:8080/app02a/Product_input.action
【问题讨论】:
-
定义“包括所有罐子”;不要让我们猜测你在部署什么。
标签: jsp tomcat struts2 http-status-code-404