Struts2 action jump to call another program

Source: Internet
Author: User
Tags i18n

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.