我想運行this示例使用struts 2.我將庫插入eclipse中動態Web項目的Web-Inf的Lib文件夾中。無法使用struts 2加載任何頁面。問題與web.xml
我的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'並檢查你的日誌。 –