I understand that the type is simply tying this action to a particular form. I understand the scope is the length of time that this action will have effect. I understand the forward parts depending on the result from the Action class. The part that has me confused it the input. I want to be able to validate a form and ensure that there is only positive or zero numbers in the field. My question is where should the input be pointing to if there is an issue? I'm confused on how that should work. The page loads with the current values and then the user is given the option to change them before submitting the page. I want validation to ensure they meet the requirements before the page is submitted. Can anyone offer some insight on this ?
Do I understand correctly in that when the current setup runs it simply re-sends the information to the page, repeating the errors in a continuous loop ?
thanks in advance for your time. [ May 16, 2007: Message edited by: A knibbs ]
I am not sure that I have ever had the input attribute point back to the same action. I often have a "display" action with validate = false and a "save" action with validate = true. The input on the save action would point back to the display action.
The thing to keep in mind with validation is that it is all done on one request cycle. The user fills out the form and submits the page. All the form values get stuck on the request. Struts populates a form object and then perform validation. If validation fails then the flow goes to your input attribute. This could be a jsp, in which case the values are still on the request so the form is populated. This could also be an action, in which case the request values are used to populate the action's form and I am pretty sure that validation will be performed if it is configured for the action.
posted 13 years ago
So basically what I have done was create an endless loop that occurs as soon as there is an error, the error is encounted sent to the input page and the cycle repeats until the max stack size is met.
So if I understand you correctly you have a display action (that is used for any saving/validating) that will continue on normally if correct and otherwise go back to the same page with the errors ? If this is the case do you simply pass along any variables that are required when populating the form ?
The part that is confusing me is that I have one that works in a similar manner, the only difference being that the one the works has all the values being initialized to 0 where as the one that doesn't work is being filled in with existing values.
thanks again for all your help on this Brent.
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad: