Dan,

If you are using a JSP 2.0 container, here is a snippet from a post I made
in the last few days on how to use the "? :" conditional statement:

JBoss v4.0 says it (like Tomcat 5.X.X) supports JSP 2.0.  So you can use the
standard Struts release and simply type in the ${expression} syntax from JSP
v2.0 directly into a struts tag or anywhere in the JSP page itself.  Do
${abc.xyz} to call the getXyz method of object abc.  Scopes should be
searched automatically in order as mentioned in previous posts today (or
yesterday) on JSP 2.0.  For IF statements, you can do ${ true ? "right" :
"wrong" } where this prints out the word "right" while it could be a method
call to retrieve data to display instead of the string "right" or the string
"wrong".

Again, "right" and "wrong" can be objects and methods (thing.piece.etc.)
instead of double quoted text words.

Or you can try using c:if + c:else OR the c:choose + c:when + c:otherwise
combo as shown here:
http://archives.java.sun.com/cgi-bin/wa?A2=ind0209&L=jsp-interest&F=&S=&P=39
142

For 2.0 ref docs, see section "ChoiceExpression" in gray on the left:
http://java.sun.com/products/jsp/syntax/2.0/card20.pdf

Regards,
David

-----Original Message-----
From: Dan Allen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 29, 2004 3:43 PM
To: Struts Users Mailing List
Subject: inline conditional expression with JSTL EL


Does anyone know if there are plans for (or if an existing library is
floating around) that allows inline conditional expressions in the
POSIX style?  An example would look something like the following:

<c:out value="${user.registered ? 'registered' : 'guest'}"/>

I realize it is possible to use c:choose tags for such a condition,
but often times a simple either/or turns out to be much more verbose
than its resulting effect on the page.

Dan

--
Open Source Advocacy
http://www.mojavelinux.com

---------------------------------------------------------------------
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