Objective: to call another program after an Action is successful.
Struts2.xml
[Html]
Copy codeThe Code is as follows: <? 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> <! -- Specify the development mode (default value: false) -->
<Constant name = "struts. devMode" value = "false"/>
<Constant name = "struts. i18n. encoding" value = "UTF-8"/>
<Constant name = "struts. custom. i18n. resources" value = "message"> </constant>
<! -- Upload the temporary file location -->
<Constant name = "struts. multipart. saveDir" value = "c: \"> </constant>
<! --
<Include file = "com/lanstar/config/struts/struts_user.xml"/>
--> Www.2cto.com
<Package name = "resume" namespace = "/" extends = "struts-default">
<Action name = "analysisAction" class = "analysisAction">
<Result name = "success">/jsp/uploadresult. jsp </result>
</Action>
<Action name = "upload" class = "uploadAction">
<Result name = "success" type = "chain">
<Param name = "actionName"> analysisAction </param>
</Result>
<! -- <Result name = "success">/jsp/uploadresult. jsp </result>
--> <Result name = "input">/jsp/Upload. jsp </result>
<Result name = "error">/jsp/error. jsp </result>
<Interceptor-ref name = "fileUpload">
<! -- Maximum size of a single uploaded file -->
<Param name = "maximumSize"> 409600 </param>
<! -- Only the types of files that can be uploaded can be viewed in tomcat web-xml. -->
<Param name = "allowedTypes"> text/html, application/msword </param>
</Interceptor-ref>
<Interceptor-ref name = "defaultStack"> </interceptor-ref>
</Action>
</Package>
</Struts>
Spring. xml
[Html]Copy codeThe Code is as follows: <! --
-Application context definition for JPetStore's business layer.
-Contains bean references to the transaction manager and to the DAOs in
-DataAccessContext-local/jta. xml (see web. xml's "contextConfigLocation ").
-->
<Beans xmlns = "http://www.springframework.org/schema/beans"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xmlns: context = "http://www.springframework.org/schema/context"
Xmlns: tx = "http://www.springframework.org/schema/tx"
Xsi: schemaLocation = "http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
Http://www.springframework.org/schema/context
Http://www.springframework.org/schema/context/spring-context-2.5.xsd
Http://www.springframework.org/schema/tx
Http://www.springframework.org/schema/tx/spring-tx-2.5.xsd>
<! -- Service start -->
<Bean id = "uploadAction" class = "com. lanstar. resume. action. UploadAction" scope = "prototype">
</Bean>
<Bean id = "analysisAction" class = "com. lanstar. resume. action. AnalysisAction" scope = "prototype">
</Bean>
</Beans>
Two methods:
When you need to save the attribute information of the previous action:
[Java]Copy codeThe Code is as follows: <result name = "success" type = "chain"> <param name = "actionName"> analysisAction </param> </result>
This method can be used if the parameter of the previous action is not saved:
[Java]Copy codeThe Code is as follows: <result name = "success" type = "redirect-action"> <param name = "actionName"> analysisAction </param> </result>