You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Philihp Busby <ph...@gmail.com> on 2006/05/06 02:45:24 UTC
Counting ActionErrors from JSP
Hi Struts List,
Is there a way through Struts and JSTL Tags to get a "count" of the
number of ActionMessages or ActionErrors?
I would like my <html:messages> to display messages in a numbered
bulleted list when there are more than one, but just display the one
outside of a list when there is only one.
Thanks,
Philihp
Re: Counting ActionErrors from JSP
Posted by Tarun Reddy <bt...@gmail.com>.
Hi,
The "indexId" attribute in <logic:iterate> tag may be useful. For more
information on this, please refer to,
http://struts.apache.org/struts-action/struts-taglib/tlddoc/logic/iterate.html
Thanks,
Tarun.
On 5/5/06, Philihp Busby <ph...@gmail.com> wrote:
>
> Hi Struts List,
>
> Is there a way through Struts and JSTL Tags to get a "count" of the
> number of ActionMessages or ActionErrors?
>
> I would like my <html:messages> to display messages in a numbered
> bulleted list when there are more than one, but just display the one
> outside of a list when there is only one.
>
> Thanks,
> Philihp
>
RE: Counting ActionErrors from JSP
Posted by Ruben Cepeda <ru...@hotmail.com>.
Philihp,
If you want to get accesses to the ActionErrors class "size()" method from a
JSP thru lets say JSTL. You will can extend the ActionErrors and makes the
method "getSize()". The access the ActionErrors class in the page my its
name (see http://struts.apache.org/struts-doc-1.2.x/api/index.html for name
details). Anyways I don't know it this is a possible solution to you. So
you might try the following scriptlet.
<%
int count =
((ActionErrors)
pageContext.findAttribute(org.apache.struts.Globals.ERROR_KEY)).size();
%>
Let the list know if any of this helped.
*************************************
Ruben Cepeda
ruben_cepeda@hotmail.com
*************************************
----Original Message Follows----
From: "Philihp Busby" <ph...@gmail.com>
Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
To: user@struts.apache.org
Subject: Counting ActionErrors from JSP
Date: Fri, 5 May 2006 20:45:24 -0400
Hi Struts List,
Is there a way through Struts and JSTL Tags to get a "count" of the
number of ActionMessages or ActionErrors?
I would like my <html:messages> to display messages in a numbered
bulleted list when there are more than one, but just display the one
outside of a list when there is only one.
Thanks,
Philihp
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org