Thanks for your input, I've tried to address what you raise below under your
points.

Niall

> -----Original Message-----
> From: Michael Hackett [mailto:[EMAIL PROTECTED]]
> Sent: 15 May 2001 16:41
> To: [EMAIL PROTECTED]
> Subject: RE: IF / ELSE and SWITCH/CASE Tags
>
>
> > 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.
>
> Why not just continue to use the existing tags for the initial test, and
> only add an ELSE tag (used in the same way) to handle the alternate
> case? Or, if a symmetrical solution is preferred, one could still use
> the THEN tags inside the existing logic test tags.

1) I like If/Else it has a familiar ring ;-) and people get it, no
explanation Equal/Else Match/Else not quite the same.

2) It was easy to create an new set of tags - testimony to the great design
of the logic tags, I just basically put a new wrapper round the exsiting
Struts functionality.

3) The IfTag works differently to the existing logic tags. It just evaluates
the condition but always processes the tags body content. The embedded
Then/Else tags check with the IfTag on whether they need to either ignore
their content or process it. To have Then/Else with the existing tags would
probably require them all to work in two different ways - as they do
currently for backward compatibility and as my IfTag does - making those 10
tags more complex, plus both my Then/Else tags would have to check if they
are embedded in one of 10 tags rather than just the one IfTag. Additionally
I am not a Struts committer and can't make the decision to change those tags
(I wouldn't anyway).

4) Only adding an Else tag means you would have to parse the tags content
and determine which bit was part of the If and which part of the else and
then modify the content so you only have the bit you want. Haven't done this
and even if its possible makes it much more complex.

>
> However, I would actually like to see something more flexible, including
> the addition of AND and OR tags for wrapping a set of conditions. Maybe
> something like:
>
> <logic:conditional>
>   <logic:and>
>     <logic:equal name="bean" property="myProp" value="1"/>
>     ...
>   </logic:and>
>   <logic:onTrue>
>     <bean:write ... >
>   </logic:onTrue>
>   <logic:onFalse>
>     ...
>   </logic:onFalse>
> </logic:conditional>
>
> For the simple case, the <logic:and> might be replaced with a
> <logic:test>, or perhaps the test tag can simply be used in its place,
> the AND and OR simply being special case tests with bodies that contain
> more tests. If this could be made compatible with the existing system,
> without making the new functionality too ugly to use, that would be even
> better.

You can of course do AND processing with the existing tags or my IfTag:
   <logic:equal .....>
      <logic:equal .....>
      </logic:equal>
   </logic:equal>

I agree AND/OR with ELSE might be interesting to add - I just addressed the
"Else" issue which many people have raised in the past and is on the 1.1
ToDo list. However, I haven't had a need for it and part of me thinks this
would be putting the Model in the View, which I'm staying away from.

Anyway, you have the source, so if you want to go and try out your ideas I'd
be interested to see how you would implement them.

>
> I'm not set on any of the tag names; I just wanted to make clear their
> purposes. Suggestions for improvements are welcomed.
>
> --
> Michael Hackett
> Developer, Pictorius Inc.
>
>

Reply via email to