简体   繁体   中英

How to dynamically set the value of “input” attribute in Action tag - Struts-config.xml (Struts 1.2)

In the struts-config.xml file,action element has a input attribute which used when the actionForm's validate method return some errors.

<action
  path="/somepath"
  attribute="someForm"
  input="/some.jsp"
  name="someForm"
  parameter="status"
  scope="request"
  type="cn.mycompany.struts.action.SomeAction"/>

But I want to change this input attribute when errors occur in the validate method,because I have more than one page submit to this action and I want it forward to the current submit page.

How can I do this,please help me. I am using Struts 1.2 version.

All you need to do is map the action again. One mapping for every input you need.

<action
path="/somepath"
attribute="someForm"
input="/some.jsp"
name="someForm"
parameter="status"
scope="request"
type="cn.mycompany.struts.action.SomeAction"/>

<action
path="/somepath2"
attribute="someForm"
input="/some2.jsp"
name="someForm"
parameter="status"
scope="request"
type="cn.mycompany.struts.action.SomeAction"/>

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