tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amos Shapira <amos.shap...@webcollage.com>
Subject RE: If/Else tag?
Date Tue, 05 Jun 2001 05:26:02 GMT
I considered this but:
 
1. It's not always clear (especially if the predicate is complex) that the
    "else" predicate is the opposite of the "if".
2. Worse - whenever you change the "if" predicate you have to remember
    to change the "else" too.  Very unmaintainable over time.
3. It's not clear that the two are actually related to each other.
4. You have to consider side-effects (as you said - if the "if" changes
    "x", but also if the evaluation of "x" has side effects).

-----Original Message-----
From: Sam Newman [mailto:sam.newman@stamplets.com]
Sent: Monday, June 04, 2001 11:23 AM
To: taglibs-user@jakarta.apache.org
Subject: Re: If/Else tag?


This tag can be used to implement if/else if/else, it just means you have to
change the predicate, e.g. and if/else would be:
 
<util:If predicate="<%= x == true>">
if condition
</util:If>
 
<util:If predicate="<%= x == false>">
else condition
</util:If>
 
This works assuming that the if conbdition block doesn't change the value of
x. 
sam

----- Original Message ----- 
From: Amos Shapira <mailto:amos.shapira@webcollage.com>  
To: 'taglibs-user@jakarta.apache.org'
<mailto:'taglibs-user@jakarta.apache.org'>  
Sent: Monday, June 04, 2001 8:39 AM
Subject: RE: If/Else tag?

Thanks.  I'm aware of this tag, but without an option for an "else"
clause the "If" tag alone is not quite useful in many cases.
 
For now, we resorted to using scriptlets when "else" is required.
 
Someone has sent code to implement an "if/then/else" tag "family",
which sort of answers my question (it doesn't accept "<%=" for the
predicate, but that can probably be combined with the existing If
tag) I hope the idea will get integrated into the taglib.
 
Cheers,
 
--Amos

-----Original Message-----
From: Procek, Brett [mailto:procek@lucent.com]
Sent: Monday, June 04, 2001 8:07 AM
To: taglibs-user@jakarta.apache.org
Subject: RE: If/Else tag?


The Utility tags provide functionality that might be useful to you.

Example:
<util:If predicate="<%= x == 5%>">
...
</util:If>
 
Brett


Mime
View raw message