Greetings, I'm using Struts 1.2.7 and noticed that functionality has been added to the Action class to store error messages in the session and subsequently be removed after they have been rendered. This is quite helpful in some circumstances.

I also know that error messages can be placed in the session or request scope when using the Exception handling framework. Again, this is quite helpful in some circumstances.

Are there plans to add this to the Validation framework as well such that we can declaratively identify the scope in which to place the validation messages. I know that upon a validation error that the default RequestProcessor forwards to a configured url and that since the request is forwarded, then there is no need to store them in the session.

I recently came upon a case where I have a page with conditionally "imported" page fragments. The page fragment contained an iframe with some dynamic text input fields. Upon a validation error in the iframe, it forwarded the request to its parent which subsequently rendered the page which subsequently and conditionally imported the page which was supposed to contain the validation error message. Since the import (c:import) was considered a separate request, the validation error messages was lost.

I ended up subclassing the ActionMapping class, adding a validationMessageScope property. I also subclassed the RequestProcessor processValidate() and added logic to look for the subclassed ActionMapping class; if found to look up the scope into which to place the validation error messages. If the property had not been set, defaulted to the request scope.

So when ever I need to propogate the validation error message across requests, I just add a <set-property property="validationMessageScope" value="session"/> and the error messages is placed in the session. Struts takes care of removing the error messages from the session after they have been rendered.

I know this is a special case. The only reason I ask is that Struts already supports the concept of storing the messages in the session and the current Exception Handling framework supports this concept. It didn't seem like too much of a stretch, to allow the Validation framework to support it.

Just a thought.

/robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to