我正在尝试跑步this http://www.vaannila.com/struts-2/struts-2-example/object-backed-java-beans-example-1.html使用struts 2的示例。我将库插入到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:文件:/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.
有什么建议 ?
我发现创建 struts 2 应用程序的最佳方法是使用 struts-blank.jar 文件。它已为您完成所有必需的配置,并且您可以删除一些示例文件。它将包含为您创建的所有 jar 和 xml 文件。
如果您仍然遇到问题,请立即尝试执行此操作...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)