How to dynamically set the value of "input" in Dispatch Action for Struts Validation
Joined: Sep 14, 2005
Hi to all
Does anyone have experience on performing Struts Validation which covers multiple methods by using DispatchAction? How do you specified the input value for each method in the dispatch action?
For example, I have a action called UserProfileAdmin, which contains 3 methods, edit user, create user, delete user. For each method it is supposed to have different value set in the attribute "input" because validation need it.
But when you use DispatchAction and defined all 3 methods in one action mapping in struts-config.xml, it allowes us to have only one "input" attribute in this action mapping definition.
In that case, no matter the validation fails in either "edit user", "create user" or "edit user", it could only forwared to a single target, which is bad...
Please help me if you know how to resolve this, thanks a lot!
Even though this post is already dead being too old. But still I wanna put more appropriate answer for it.
for your 3 methods editUser(----), createUser(----) and deleteUser(----) configure your DispatchAction class 3 times in struts-config.xml with same type="" value and if you are also using single common ActionForm(form bean) class take same values for name="" in all 3 configurations. just change the input="" values according to your need.(But put 3 different action="" values in each config.)
And in validation.xml file tale <form name="action value used by particular form page to transfer control to DipatchAction class">.....