On Wed, 19 Jan 2005 18:49:52 -0600, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I need to know an additional question:
> You sent me:
>
> <c:forEach items="${sessionScope.auditorList}" var="auditor"
> varStatus="status">
>
> I need to know if this would be correct as well, where
> creditApplicationListDto.businessLine is a Boolean:
>
> <c:forEach items="${creditApplicationListDto.businessLine}" var="true"
> varStatus="status">
Nope. "items" should evaluate to a collection.
In JSTL it would be something like the below code to solve your
problem (I haven't tested it, Just wrote it on top of my head)
<c:if test="${creditApplicationListDto.businessLine}">
<bean:message key="label.bln"/>
<c:set var="found" value="true"/>
</c:if>
<c:if test="${creditApplicationListDto.businessCard}">
<c:choose>
<c:when test="${found}">
, <bean:message key="label.bcard"/>
</c:when>
<c:otherwise>
<bean:message key="label.bcard"/>
<c:set var="found" value="true"/>
</c:otherwise>
</c:choose>
</c:if>
<c:if test="${creditApplicationListDto.securedCard}">
<c:choose>
<c:when test="${found}">
, <bean:message key="label.seccard"/>
</c:when>
<c:otherwise>
<bean:message key="label.seccard"/>
<c:set var="found" value="true"/>
</c:otherwise>
</c:choose>
</c:if>
<c:if test="${creditApplicationListDto.equipmentExpress}">
<c:choose>
<c:when test="${found}">
, <bean:message key="label.equipExpress"/>
</c:when>
<c:otherwise>
<bean:message key="label.equipExpress"/>
<c:set var="found" value="true"/>
</c:otherwise>
</c:choose>
</c:if>
Look how large the chunk of code is. Better way of doing it is by
having some sort of an utility method or using a tag as "Jim"
suggested
>
> --------------------
> Mick Knutson
> Wells Fargo Business Direct
> (415) 222-1020
>
> "This message may contain confidential and/or privileged information. If you
> are not the addressee or authorized to receive this for the addressee, you
> must not use, copy, disclose, or take any action based on this message or any
> information herein. If you have received this message in error, please advise
> the sender immediately by reply e-mail and delete this message. Thank you for
> your cooperation."
> --------------------
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 14, 2005 11:18 AM
> To: Struts Users Mailing List
> Subject: Re: Help with logic tags, and commas please.
>
> Not exactly the same, since I have use of a list but here's how I handled
> it in JSTL...
>
> <c:forEach items="${sessionScope.auditorList}" var="auditor"
> varStatus="status">
>
> <c:if test="${!status.last}">
> <c:out value="${auditor.name}"/>, 
> </c:if>
>
> <c:if test="${status.last}">
> <c:out value="${auditor.name}"/>
> </c:if>
>
> </c:forEach>
>
> Bart
>
> <[EMAIL PROTECTED]> wrote on 01/14/2005 02:04:07 PM:
>
> > I have the following code that prints something like this:
> > BLN, BCard, SecCard, EquipExp
> >
> > There may be any combination of any of these 4 items, or non at all.
> > And what I want is the ability to properly add commas after each
> > item, or not print a comma if there is not an item:
> >
> > <logic:equal name="creditApplicationListDto" property="businessLine"
> > value="true">
> > <bean:message key="label.bln"/> ,
> > </logic:equal>
> > <logic:equal name="creditApplicationListDto" property="businessCard"
> > value="true">
> > <bean:message key="label.bcard"/> ,
> > </logic:equal>
> > <logic:equal name="creditApplicationListDto" property="securedCard"
> > value="true">
> > <bean:message key="label.seccard"/> ,
> > </logic:equal>
> > <logic:equal name="creditApplicationListDto"
> > property="equipmentExpress" value="true">
> > <bean:message key="label.equipExpress"/>
> > </logic:equal>
> >
> >
> > --------------------
> > Mick Knutson
> > Wells Fargo Business Direct Information Systems
> > (415) 222-1020
> >
> > "This message may contain confidential and/or privileged
> > information. If you are not the addressee or authorized to receive
> > this for the addressee, you must not use, copy, disclose, or take
> > any action based on this message or any information herein. If you
> > have received this message in error, please advise the sender
> > immediately by reply e-mail and delete this message. 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]