This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Struts Validation" Watch "Struts Validation" New topic
Author

Struts Validation

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Is it possible to specify the <form name=ACTIONAME"> in Validation.xml instead of actual form name
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
short answer, no

i am assuming you are looking to validate depending on which action you call, particularly you don't want validation to occur when the user is presented the first time? there are a couple of ways to go about it.

1. use requiredif rule or validwhen (struts 1.2), you'll need to have a hidden field being set on submit (via javascript). if that field is blank, then don't validate. ugly? yes!

2. structure your action-mappings intelligently. create 2 action mappings with 2 different paths, but pointing to the same form-bean. in the second action, change the validate attribute to "true" and set the input to the path of the first action-mapping.

ex.
<action path="form/entry" name="MyForm">....</action>
<action path="form/process" name="MyForm" type="ProcessAction" validate="true" input="form/entry.do">....</action>

intially, the user goes to /form/entry.do which (the jsp/tile) contains a form mapped to the action "form/process".


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Validation
 
Similar Threads
Problems with date validation in Struts 1.2.4
Enable isn't working in script
Calling a javascript function
Struts validation not displaying error messages
Struts Validation not working