The action:errors tag is a convenient interface to the Struts
ApplicationResources. Any component in the application is welcome to use
the ApplicationResources (hence the "application" moniker).

What you might want to do is save the message key in the inputErrors
property and then use bean:message to write it out. This will make it a
drop-in replacement for action:errors. 

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


Michael Marrotte wrote:
> 
> One way I thought of to do this is to store any errors in the bean that
> <logic:iterate> uses, e.g.:
> 
>         <logic:iterate id="jspBean" name="javaBean" property="javaBeanProperty">
>                 <td>
>                         item <bean:write name="jspBean" property="item"/>
>         </td>
>                 <td>
>                         qty <bean:write name="jspBean" property="qty"/>
>         </td>
>                 <td>
>                         <bean:write name="jspBean" property="inputErrors"/>
>         </td>
>         </logic:iterate>
> 
> But, here I'm using the "inputErrors" property of the "javaBeanProperty" of
> "javaBean" and I'm not using the <html:error> tag.  Am I cheating or missing
> something in Struts that provides a consistent (more MVC) way to deal with
> this.
> 
> What do you think of the above approach?  Any thoughts are greatly
> appreciated?
> 
> Thanks in advance,
> 
> --Michael Marrotte
> 
> -----Original Message-----
> From: DHS Struts [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 17, 2002 7:33 AM
> To: [EMAIL PROTECTED]
> Subject: Re: How do you recommend doing this with Struts?
> 
> Read the JavaDocs on ActionError, ActionErrors, and the html:error tag. I
> think you'll find that you can position error messages next to the user
> value that is incorrect.
> 
> mark n.
> 
> >From: "Michael Marrotte" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Subject: How do you recommend doing this with Struts?
> >Date: Thu, 16 May 2002 17:29:22 -0400
> >
> >Say the following form (FORM A) -- maybe representative of a shopping
> >cart -- is generated dynamically:
> >
> >FORM A:
> >-------------------------
> >| item a | qty __  |
> >-------------------------
> >| item b | qty __  |
> >-------------------------
> >| ...                   |
> >-------------------------
> >| item n | qty __  |
> >-------------------------
> >
> >And, say the user submits the values "2,M, and 3" for items "a,b and n",
> >respectively.  Assuming "M" is an invalid "qty", the following form (FORM
> >A,
> >again with error messages) gets generated:
> >
> >FORM A:
> >ERROR:  Please fix errors marked, below.
> >-------------------------
> >| item a | qty  2  |
> >-------------------------
> >| item b | qty M  | ERROR: Invalid qty.
> >-------------------------
> >| ...                   |
> >-------------------------
> >| item n | qty  3  |
> >-------------------------
> >
> >How do you recommend doing this with Struts?  What class(es) should be
> >used?
> >How can errors be stored and retrieved dynamically?
> >
> >Thanks in advance,
> >
> >--Michael Marrotte
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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

Reply via email to