无法使用 struts 2 加载任何页面.web.xml 的问题 [英] Cant load any page with struts 2 . Issue with web.xml
问题描述
我正在尝试运行 this 使用 struts 2 的示例.我将库插入到 Eclipse 中一个动态 Web 项目的 Web-Inf 的 Lib 文件夹中.
我的 Web.xml 现在看起来像这样:
<过滤器><filter-name>struts2</filter-name><过滤器类>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</过滤器类></过滤器><过滤器映射><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></过滤器映射></web-app>
我创建了 struts.xml 并将其放在源文件夹中,其内容是
<支柱><!-- 默认包的配置.--><package name="default" extends="struts-default"><action name="UserAction" class="struts.UserAction"><结果名称="输入">/index.jsp</result><result name="success">/result.jsp</result></动作></包></支柱>
所以现在当我运行任何 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 状态 404 -类型状态报告信息描述 请求的资源 () 不可用.
有什么建议吗?
好像少了一些 jars .. !!
常见的依赖是 ::
commons-fileupload-1.2.1.jar- commons-io-1.3.2.jar- commons-logging-1.0.4.jar- commons-logging-api-1.1.jar- freemarker-2.3.15,jar- log4j-1.2.14.jar- ognl-2.7.3.jar- xwork-core-2.1.6.jar
检查版本号并将 jars 添加到类路径.
I am trying to run this example using struts 2. I inserted the libraries in the Lib folder of Web-Inf of a dynamic web project in eclipse.
My Web.xml looks like this now:
<?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>
and i created the struts.xml and placed it inside the source folder , the content of which is
<!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>
So now when i run any jsp i get the following error in eclipse console
Unable to load configuration. - 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
and this on the webpage
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
Any suggestions ?
Seems like some jars are missing .. !!
The common dependecies are ::
commons-fileupload-1.2.1.jar
- commons-io-1.3.2.jar
- commons-logging-1.0.4.jar
- commons-logging-api-1.1.jar
- freemarker-2.3.15,jar
- log4j-1.2.14.jar
- ognl-2.7.3.jar
- xwork-core-2.1.6.jar
Check the version number and add jars to classpath.
这篇关于无法使用 struts 2 加载任何页面.web.xml 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!