Yes, I wouldn't be able to get away with the empty <div> tag -- it would create a great big red box on my page which wouldn't be acceptable.
I'm working on extending html:messages, and it's working quite well (and surprisingly easily) so far. I'll do some more testing tomorrow and if all goes well, I'll post what I've done. Again, thank you very much for your help. Chris -----Original Message----- From: Kishore Senji [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 16, 2005 1:08 PM To: Struts Users Mailing List Subject: Re: Displaying errors for all except one key On 8/16/05, Chris Loschen <[EMAIL PROTECTED]> wrote: > Thank you very much for the idea. I'm starting to wrestle with it. > > My first instinct is that I'm going to need to extend html:messages > because the JSP solution below wouldn't work (I think!) with the HTML > structure -- in other words, I'm going to end up with a new <div><ul> > for every new error instead of the single div and ul for the whole set > that I need. But I couldn't rearrange it either because then if I have > only the error I want to exclude, I still get the (now empty) <div><ul>. > Does that sound right? If you have the something like this in your jsp, even if you have only one error that you would want to exculde you will be left with only a <div></div> <div class="errorMsg"> <logic:iterate id="property" name="errors"> <logic:notEqual name="property" value="<%=RIGHT_PANE_THRESHOLD_PROPERTY%>" type="java.lang.String"> <ul> <html:messages id="message" message="false" property="<%=property%>"> <li><bean:write name="message"/></li> </html:messages> </ul> </logic:notEqual> </logic:iterate> </div> If you don't like to display the empty div when there are no errors, you would have to do some processing of the "properties" to see if you have atleast one other property other than the one that you want to exclude then only show the div and the errors. But anyway, is showing an empty div that big of an issue? > I'm tracking down the appropriate source code so that I can look at > the messages tag. I'm thinking that what I need to do is simply > iterate through my errors, copy each one that isn't in my excluded > list (for now, only one, but might grow later) to a new collection, > and then pass that new collection to super along with the appropriate > arguments. Does that sound reasonable, or am I missing something? There is no super method in HtmlMessages tag that can take the collection of errors and iterate. You would have to override the doStartTag of the HtmlMessages tag and create the iterator excluding the errors that you don't want to see. > > Thanks again for your help. > > Chris > > -----Original Message----- > From: Kishore Senji [mailto:[EMAIL PROTECTED] > Sent: Monday, August 15, 2005 6:15 PM > To: Struts Users Mailing List > Subject: Re: Displaying errors for all except one key > > I believe the reason that the Validator errors are missing is that > Validator keys the errors with the property name of the form field. > And so, if you say that just show the errors whose property is > "ActionErrors.GLOBAL_ERROR" you would definitely miss out on the > Validator errors. It has nothing to do with the usage of the > deprecated ActionError and I believe you would still run in to this > problem even if you use ActionMessage > > There are two options. > > 1) Extend html:messages to shown messages for all but a given property > 2) > In the JSP you would follow the following steps > > ActionErrors actionErrors = (ActionErrors) > RequestUtils.getInstance().getActionErrors(pageContext, > Globals.ERROR_KEY); > Iterator errors = actionErrors.properties(); > pageContext.setAttribute("errors", errors); <logic:iterate id="property" > name="errors"> > <logic:notEqual name="property" > value="<%=RIGHT_PANE_THRESHOLD_PROPERTY%>" type="java.lang.String"> > <div class="errorMsg"><ul> > <html:messages id="message" message="false" > property="<%=property%>"> > <li><bean:write name="message"/></li> > </html:messages> > </ul></div> > </logic:notEqual> > </logic:iterate> > > Basically, you would be iterating over all the properties and showing > the errors to all but the property that you don't want to show the > errors for. [Note: one thing to note would be, I don't know if the > ordering of the errors will be the same of that you would get if you > leave the iteration to the html:messages.] > > On 8/15/05, Chris Loschen <[EMAIL PROTECTED]> wrote: > > Does anyone have some ideas for me? Thank you! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > _______________ > Siebel > IT'S ALL ABOUT THE CUSTOMER > Visit www.siebel.com > > This e-mail message is for the sole use of the intended recipient(s) and contains confidential and/or privileged information belonging to Siebel Systems, Inc. or its customers or partners. Any unauthorized review, use, copying, disclosure or distribution of this message is strictly prohibited. If you are not an intended recipient of this message, please contact the sender by reply e-mail and destroy all soft and hard copies of the message and any attachments. Thank you for your cooperation. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]