struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <lmead...@apache.org>
Subject Re: Newbie help with Struts idiom: functional if/else tags
Date Mon, 14 Nov 2005 19:41:57 GMT
I like this:

<c:choose>
  <c:when test="${bean.property}">true</c:when>
</c:choose>

Larry

On 11/14/05, Michael Jouravlev <jmikus@gmail.com> wrote:
> Use either Struts <logic:equal> or JSTL <c:if> or bare scriptlet. In
> your particular case you can make the decision in the bean itself. Do
> not print HTML tags from Java, this produces unmaintable and
> unportable code.
>
> Michael.
>
> On 11/14/05, Mark S Petrovic <mark@petrovic.org> wrote:
> > Good day.  I am new to Struts, and while I am coming up to speed, I'm
> > still struggling with what are surely common idioms.
> >
> > In a JSP, I want to output, say, a <td> element body conditionally based
> > on a given bean property.
> >
> > In pseudocode, I want
> >
> > if bean.property == true
> >    print <td> X </td>
> > else
> >    print <td> Y </td>
> >
> > I examined the Struts Logic tags, but found no if/else construct, and
> > I suspect there is a good reason for this.
> >
> > Does Struts culture encourage me to somehow move the solution into the
> > bean itself, or is there a informed, stylish way to deal with this in
> > the JSP?
> >
> > Thank you.
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message