Can I submit these logic tags for inclusion in Struts - they are on the TODO
list for 1.1?
Attached are tags to do If/Else and Switch/Case logic, based on existing
Struts logic tag classes - the key classes inherit from the Struts
CompareTagBase.
1) IF/ELSE: (IfTag, ThenTag, ElseTag)
The IfTag provides the same functionality as the Equal, NotEqual, LessEqual,
LessThan, GreaterThan, GreaterEqual, Match, NoMatch, Present, NotPresent
tags by specifying that in the "op" attribute.
Example Usage:
<logic:if op="GreaterThan" name="testbean" property="doubleProperty"
value="400">
<logic:then>
Property Greater Than Value
</logic:then>
<logic:else>
Property Not Greater Than Value
</logic:else>
</logic:if>
2) SWITCH/CASE: (SwitchTag, CaseTag, DefaultTag)
Example Usage:
<logic:switch name="testbean" property="doubleProperty">
<logic:case value ="1">1 matched</logic:case>
<logic:case value ="321">321 matched 1st</logic:case>
<logic:case value ="321">321 matched 2nd</logic:case>
<logic:case value ="555">555 matched</logic:case>
<logic:default>No values matched - default processing</logic:default>
</logic:switch>
[[ LOGIC.ZIP : 1568 in winmail.dat ]]
winmail.dat