简体   繁体   中英

Need understanding about struts-config.xml file

Let's say i have a struts-config.xml file, putting action tag only :

</action>
            <action path="/import"
                type="com.app.console.CSVAction"
                    scope="session"
                    name="formName"
                    input="/example.jsp"
                    validate="true">
            <forward name="success" path="/myAction.do?subAction=import"/>
 </action>
  1. What is the role of path attribute, will it call reset method of myAction also.
  2. What if i put redirect parameter to true.

I am asking this question because in my code.. the actionform is getting reset always(where all bean properties will be reset) corresponding to myAction.do, when i call the action myAction.do above.

Please provide the detailed explanation.

  • The path attribute defines the URL of the action.
  • Why would it call an arbitrarily-named action method?!
  • Oh you mean your action form . reset is always called by the framework, as per the documentation. Reset is almost only for initial checkbox values to work around how HTTP/clients handle unchecked checkboxes.
  • It will redirect to the forward.

Please consider reading some Struts 1 documentation.

If you specify redirect="true", Struts uses a client-side redirect [

response.sendRedirect()].

The JSP will be invoked by a new browser request, and any data stored in the old request will be lost.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM