This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
The problem described must be commonplace and surely must have been discussed before. Apologies for bringing it up again.
I have a simple action class named say Hello in struts.xml, and have the validations specified in xml (Hello-validation.xml). The messages come up when invoking Hello. How do we prevent the messages from appearing when invoking 'hello.action'? They should appear only when the user posts the form.
Read somewhere that S2 will ensure this when the action class returns INPUT. That does not seem to work. A bit curious about the best practice to follow here...
Posting to the form shouldn't be handled by the same means used to reach the form initially. Either display the form via the action's input() method (validation is bypassed for a small list of action methods), or display the form initially through a different action definition.
(Or differentiate between GET and POST in an interceptor, and automagically call input() when it's a GET request.)