You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Frank Nestel <do...@bigfoot.com> on 2000/06/26 15:35:31 UTC

Else-Tag

Hello,

maybe the attached Zip-File is any useful: It is a rework of all 
struts:If-Tags, they are now all based upon an abstract
BaseIfTag class which keeps a stack of past if's and allows the 
included ElseTag class to work as expected also in case of
nested If's.

the Syntax is like

	<struts:ifXYZ>
	    <struts:ifUVW>
 	       ...
	    </struts:ifUVW>
	    <struts:else>
	       ...
	    </struts:else>
	</struts:ifXYZ>
	<struts:else>
	  ...
	</struts:else>

An exception is thrown, in case if duplicated else-Tags on the 
same level

	<struts:ifXYZ>
	  ...
	</struts:ifXYZ>
	<struts:else>
	  ...
	</struts:else>
	<struts:else> <!-- causes JspException -->
	  ...
	</struts:else>

The ElseTag does not capture the following (weird) syntax,
but we can consider that a feature:

	<struts:ifXYZ>
	  ...
	</struts:ifXYZ>
	  inserted HTML here <!-- will appear anyway, though else will work -->
	<struts:else>
	  ...
	</struts:else>

CAUTION: I only did a coarse testing, which seemed ok. For testing
reasons 
I moved the new classes to a dummy package named taglibq, they shouldn't 
remain there. 

Policy question: I included my own header in all those classes, though I
have
to confess that the code is 95% the same to the predecessors. I also use 
different coding conventions like you did and partially reworked the
code
to my conventions...

Cheers,
Frank.

-- 
---------------------------------ooO---"---Ooo--------------
Spiele von Doris und Frank, Dr. Frank Sven Nestel,
Wolfsstaudenring 32, D-91056 Erlangen-Kriegenbrunn, GERMANY. 
dorisnfrank@bigfoot.com                 "I hate this game,
http://www.bigfoot.com/~dorisnfrank      lets play it again"
SOON moving to: http://doris-frank.de
AND ALSO on   : http://duf.damud.com