我使用struts2開發web應用程序。
我已經包含了struts2所需的jar,但是當它打算調用struts動作類時,它會拋出404錯誤。
在控制檯上沒有錯誤,瀏覽器沒有顯示.action擴展,它顯示了struts.xml調用操作類時的情況。
我正在使用jdk 1.6
和struts 2.0
。
我是否缺少任何負責這一切的jar。
Struts 2 action class not working
在JSP中,我只是從
<s:form action = "Mergexmlaction" method = "post"/>
調用函數下面是我在struts.xml和web.xml
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.0.dtd">
<struts>
<constant name="struts.multipart.maxSize" value="6000000000" />
<package name="default" namespace="/jsp" extends="struts-default">
<action name="Mergexmlaction" class="com.hm.merge.mergeaction.Mergexmlaction">
<result name="success" >/jsp/Result.jsp</result>
<result name="error" >/jsp/Browse_multiplexmlfiles.jsp</result>
<interceptor-ref name="fileUpload">
<param name="maximumSize">600000000</param>
</interceptor-ref>
</action>
</package>
</struts>
網絡。 xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="xml_file_merging" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>xml_file_merging</display-name>
<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>
<welcome-file-list>
<welcome-file>jsp/Browse_multiplexmlfiles.jsp</welcome-file>
</welcome-file-list>
</web-app>
web.xml怎麼樣?你在那裏設置了struts調度器嗎? – Thomas 2012-02-09 07:29:44
需要大量信息?關於你的web.xml,當你得到這些信息時你打的是什麼URL,沒有這個URL就無法回答。 – 2012-02-09 07:31:42
我已經添加了我的struts和web.xml文件....
在jsp中,我只是簡單地調用函數s:form – 2012-02-09 07:47:27