You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by gl...@cmhc.ca on 2005/08/18 15:48:45 UTC
- bis
Greetings,
I have sent this post more almost 2 days ago without one response.
I hope it was simply lost with other posts but still worthy of attention.
Here is the original post:
I am unable to find a solution... even after searching... and waiting for
the espresso to kick in.
I have messages and would like to determine the number of messages in the
bean.
If there is more than one message format the output as a list or else just
display the message.
Unable to come up with something.
This is what I am currently using:
<logic:messagesPresent message="true">
<tr>
<td colspan="5" class="informationalMessage">
<html-el:messages id="message" message="true">
<bean: write name="message" filter="false"/><br>
</html-el:messages>
</td>
<td></td>
</tr>
<tr>
<td colspan="6" height="5"></td>
</tr>
</logic:messagesPresent>
Any ideas would be greatly appreciated !
- Glenn
Re: - bis
Posted by Glenn DeschĂȘnes <ma...@gmail.com>.
Thanks so much for your reply!!!
I will certainly try your suggestions out.
Greatly appreciated,
Glenn
On 8/18/05, Laurie Harper <la...@holoweb.net> wrote:
>
> Heh: even more of a hack, provided you're OK keeping with lists rather than
> tables as in your original example:
>
> <logic:messagesPresent message="true">
> <c:set var="count" value="0"/>
> <ul id="msgs">
> <html:messages id="msg">
> <c:set var="count" value="${count + 1}"/>
> <li><c:out value="${msg}"/></li>
> </html:messages>
> </ul>
> <c:if test="${count gt 1}"/>
> <style>
> #msgs { list-style: none; }
> </style>
> </c:if>
> </logic:messagesPresent/>
>
> Laurie Harper wrote:
>
> > I can't think of a way to find out how many messages are queued for
> > display, but you could do something like this (ugly, and untested):
> >
> > <c:set var="first" value="true"/>
> > <c:set var="prev" value=""/>
> > <html:messages id="msg">
> > <c:if test="${not empty prev}">
> > <%-- 2nd or subsequent messsage --%>
> > <c:if test="${first}">
> > <%-- This is the 2nd message of N; start the list --%>
> > <c:set var="first" value="false"/>
> > <ul>
> > </c:if>
> > <%-- output previous message --%>
> > <li><c:out value="${prev}/></li>
> > </c:if>
> > <%-- Store current message --%>
> > <c:set var="prev" value="${msg}"/>
> > </html:messages>
> > <c:if test="${not empty prev}">
> > <%-- There was at least one message --%>
> > <c:if test="${first}">
> > <%-- There was only one message; show it --%>
> > <c:out value="${prev}"/>
> > </c:if>
> > <c:if test="${not first}">
> > <%-- There was more than one message;
> > output final message and end list. --%>
> > <li><c:out value="${prev}"/></li></ul>
> > </c:if>
> > </c:if>
> >
> > glenn.deschenes@cmhc.ca wrote:
> >
> >> Greetings,
> >>
> >> I have sent this post more almost 2 days ago without one response.
> >> I hope it was simply lost with other posts but still worthy of attention.
> >> Here is the original post:
> >>
> >> I am unable to find a solution... even after searching... and waiting
> >> for the espresso to kick in.
> >>
> >> I have messages and would like to determine the number of messages in
> >> the bean.
> >> If there is more than one message format the output as a list or else
> >> just display the message.
> >> Unable to come up with something.
> >>
> >> This is what I am currently using:
> >> <logic:messagesPresent message="true">
> >> <tr>
> >> <td colspan="5" class="informationalMessage">
> >> <html-el:messages id="message" message="true">
> >> <bean: write name="message" filter="false"/><br>
> >> </html-el:messages>
> >> </td>
> >> <td></td>
> >> </tr>
> >> <tr>
> >> <td colspan="6" height="5"></td>
> >> </tr>
> >> </logic:messagesPresent>
> >>
> >> Any ideas would be greatly appreciated !
> >> - Glenn
> >
> >
> >
>
>
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: - bis
Posted by Laurie Harper <la...@holoweb.net>.
Heh: even more of a hack, provided you're OK keeping with lists rather than
tables as in your original example:
<logic:messagesPresent message="true">
<c:set var="count" value="0"/>
<ul id="msgs">
<html:messages id="msg">
<c:set var="count" value="${count + 1}"/>
<li><c:out value="${msg}"/></li>
</html:messages>
</ul>
<c:if test="${count gt 1}"/>
<style>
#msgs { list-style: none; }
</style>
</c:if>
</logic:messagesPresent/>
Laurie Harper wrote:
> I can't think of a way to find out how many messages are queued for
> display, but you could do something like this (ugly, and untested):
>
> <c:set var="first" value="true"/>
> <c:set var="prev" value=""/>
> <html:messages id="msg">
> <c:if test="${not empty prev}">
> <%-- 2nd or subsequent messsage --%>
> <c:if test="${first}">
> <%-- This is the 2nd message of N; start the list --%>
> <c:set var="first" value="false"/>
> <ul>
> </c:if>
> <%-- output previous message --%>
> <li><c:out value="${prev}/></li>
> </c:if>
> <%-- Store current message --%>
> <c:set var="prev" value="${msg}"/>
> </html:messages>
> <c:if test="${not empty prev}">
> <%-- There was at least one message --%>
> <c:if test="${first}">
> <%-- There was only one message; show it --%>
> <c:out value="${prev}"/>
> </c:if>
> <c:if test="${not first}">
> <%-- There was more than one message;
> output final message and end list. --%>
> <li><c:out value="${prev}"/></li></ul>
> </c:if>
> </c:if>
>
> glenn.deschenes@cmhc.ca wrote:
>
>> Greetings,
>>
>> I have sent this post more almost 2 days ago without one response.
>> I hope it was simply lost with other posts but still worthy of attention.
>> Here is the original post:
>>
>> I am unable to find a solution... even after searching... and waiting
>> for the espresso to kick in.
>>
>> I have messages and would like to determine the number of messages in
>> the bean.
>> If there is more than one message format the output as a list or else
>> just display the message.
>> Unable to come up with something.
>>
>> This is what I am currently using:
>> <logic:messagesPresent message="true">
>> <tr>
>> <td colspan="5" class="informationalMessage">
>> <html-el:messages id="message" message="true">
>> <bean: write name="message" filter="false"/><br>
>> </html-el:messages>
>> </td>
>> <td></td>
>> </tr>
>> <tr>
>> <td colspan="6" height="5"></td>
>> </tr>
>> </logic:messagesPresent>
>>
>> Any ideas would be greatly appreciated !
>> - Glenn
>
>
>
--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: - bis
Posted by Laurie Harper <la...@holoweb.net>.
I can't think of a way to find out how many messages are queued for
display, but you could do something like this (ugly, and untested):
<c:set var="first" value="true"/>
<c:set var="prev" value=""/>
<html:messages id="msg">
<c:if test="${not empty prev}">
<%-- 2nd or subsequent messsage --%>
<c:if test="${first}">
<%-- This is the 2nd message of N; start the list --%>
<c:set var="first" value="false"/>
<ul>
</c:if>
<%-- output previous message --%>
<li><c:out value="${prev}/></li>
</c:if>
<%-- Store current message --%>
<c:set var="prev" value="${msg}"/>
</html:messages>
<c:if test="${not empty prev}">
<%-- There was at least one message --%>
<c:if test="${first}">
<%-- There was only one message; show it --%>
<c:out value="${prev}"/>
</c:if>
<c:if test="${not first}">
<%-- There was more than one message;
output final message and end list. --%>
<li><c:out value="${prev}"/></li></ul>
</c:if>
</c:if>
glenn.deschenes@cmhc.ca wrote:
> Greetings,
>
> I have sent this post more almost 2 days ago without one response.
> I hope it was simply lost with other posts but still worthy of attention.
> Here is the original post:
>
> I am unable to find a solution... even after searching... and waiting for
> the espresso to kick in.
>
> I have messages and would like to determine the number of messages in the
> bean.
> If there is more than one message format the output as a list or else just
> display the message.
> Unable to come up with something.
>
> This is what I am currently using:
> <logic:messagesPresent message="true">
> <tr>
> <td colspan="5" class="informationalMessage">
> <html-el:messages id="message" message="true">
> <bean: write name="message" filter="false"/><br>
> </html-el:messages>
> </td>
> <td></td>
> </tr>
> <tr>
> <td colspan="6" height="5"></td>
> </tr>
> </logic:messagesPresent>
>
> Any ideas would be greatly appreciated !
> - Glenn
--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org