【发布时间】:2012-06-11 19:33:47
【问题描述】:
我正在尝试使用 struts 2 运行 this 示例。我将库插入到 Eclipse 中动态 Web 项目的 Web-Inf 的 Lib 文件夹中。
我的 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" version="2.5">
<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 并将其放在源文件夹中,其内容是
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- Configuration for the default package. -->
<package name="default" extends="struts-default">
<action name="UserAction" class="struts.UserAction">
<result name="input">/index.jsp</result>
<result name="success">/result.jsp</result>
</action>
</package>
</struts>
所以现在当我运行任何 jsp 时,我会在 Eclipse 控制台中收到以下错误
无法加载配置。 - bean - jar:file:/D:/Users/Don/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/Mscs674-Struts2/WEB-INF/lib/struts2-gxp -plugin-2.3.4.jar!/struts-plugin.xml:8:162
网页上有这个
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
有什么建议吗?
【问题讨论】:
-
当你告诉人们你把东西放在什么目录中时,在大小写等方面非常准确真的很重要。例如,现在,你的目录列表不正确 - 库应该放在
WEB-INF/lib中,大写。 -
另外,这是一个非常旧的 S2 版本,应该不使用。 @Fidrizers 列表中的库更新(但仍然很旧),并且可能不适用于旧版本的 S2。此外,您看到与 GXP 插件有关的问题意味着您包含了您不使用的库,而您应该不这样做——插件可以改变S2 的默认行为。打开
devMode并检查您的日志。
标签: struts2