PDA

View Full Version : Integrating spring errors struts app with shared errors tile


pelletk
Apr 16th, 2006, 01:06 AM
I'm working on converting portions of a large Struts app to SWF.

There is one minor sticky bit I've run into.

The application uses tiles, and there is a common errors jsp tile for all page layouts. This page currently renders any errors and messages exposed by a Struts form.

Being that this application now has a mixture of SWF (I'm using no Struts forms for the SWF parts - all Spring binding and validation), I'd like to be able to render the Spring errors in a similar fashion on the same page. This way all of the surrounding tiles layout remains the same, and errors from whichever underlying binding/validation appear uniformly.

Is there a recommended way to make it possible to refer to the error messages for the form generically; in a way that the errors tile needn't know what the fbo name is to bind to in order to get the ${status.errorMessage} into scope for rendering?

If this were in a common tile for all page layouts, how could I avoid knowing the fbo by name for binding?


<spring:bind path="aParticularFormBackingObject">
<c:forEach items="${status.errorMessages}">
... render the errors list ...
</c:forEach>
</spring:bind>

cchew
Apr 24th, 2006, 09:01 PM
Hi there,

I think our applications are similar - started off as Struts app that is in the process of being SWF'ed.

In terms of our error handling tile (for displaying the old GLOBAL_MESSAGES), so far we are still using a combination of Struts/jstl tags:


<logic:messagesPresent>
<ul>
<html:messages id="error">
<li><bean:write name="error"/></li>
</html:messages>
</ul>
</logic:messagesPresent>


For field-specific errors, we have a custom taglib for our field labels that do this along with marking up (dynamic) mandatory field labels.

Hope that helps.

Cheers!
Ching