Okay, while out for lunch i thought about it and i think the right way of
doing it would be to use "property" attribute of the <html:messages> tag:

http://jakarta.apache.org/struts/userGuide/struts-html.html#messages

henc new code:

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

I wish i could have been able to check it but let's see if it works!

ATTA

----- Original Message ----- 
From: "Asif Rahman" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, June 24, 2004 1:26 PM
Subject: Re: Problem with displaying a subset of error messages using
<html:messages>


> Hi Atta,  this is what I'm getting when I try that:
>
> javax.servlet.jsp.JspTagException: javax.servlet.jsp.JspException: An
error
> occurred while evaluating custom action attribute "test" with value
> "${error.key == 'company'}": Unable to find a value for "key" in object of
> class "java.lang.String" using operator "." (null)
>  at
org.apache.taglibs.standard.tag.el.core.IfTag.condition(IfTag.java:102)
>
> Any ideas?
>
> -Asif
>
> ----- Original Message ----- 
> From: "atta-ur rehman" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; "Asif Rahman"
> <[EMAIL PROTECTED]>
> Sent: Thursday, June 24, 2004 4:04 PM
> Subject: Re: Problem with displaying a subset of error messages using
> <html:messages>
>
>
> > Hello Asif,
> >
> > Now I havn't checked what I'm going to write here but am pretty sure it
> > should work.
> >
> > First of all while adding your ActionError to ActionErrors use 'company'
> as
> > the key for the company errors and 'factory' for factory related error
> > messages.
> >
> > like:
> >
> > ActionErrors errors = new ActionErrors();
> > errors.add('company', new ActionError(....));
> > errors.add('factory', new ActionError(....));
> >
> > now in you loop wrap you bean:wrie in an if statement:
> >
> > <logic:messagesPresent>
> >      <html:messages id="error">
> >         <c:if test="${error.key == 'company'}">
> >             <li><bean:write name="error"/></li>
> >         </c:if>
> >      </html:messages>
> >   <br><br>
> > </logic:messagesPresent>
> >
> >
> > hope this work and helps!
> >
> > ATTA
> >
> > ----- Original Message ----- 
> > From: "Asif Rahman" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Thursday, June 24, 2004 12:48 PM
> > Subject: Problem with displaying a subset of error messages using
> > <html:messages>
> >
> >
> > Hi Im have been using pretty standard code to display error messages so
> far,
> > eg:
> >
> > <logic:messagesPresent>
> >      <html:messages id="error">
> >         <li><bean:write name="error"/></li>
> >      </html:messages>
> >   <br><br>
> > </logic:messagesPresent>
> >
> >
> > But now, the problem I am facing is that I want to display a subset of
my
> > error messages in one part of page, (e.g. Error messages that start with
> > "Company") and the rest of the messages (ones that start with "Factory")
> in
> > another section of the page.  I've read the docs but really havent been
> able
> > to figure this one out.  Can someone plese help me?  Thanks.
> >
> > -Asif
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]

Reply via email to