This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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">.....