You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by James Turner <tu...@blackbear.com> on 2003/01/03 22:44:09 UTC

Proposed: logic:else clause

I find in my code, I do the following a lot:

<logic:equal name="foo" property="bar" value"baz">
.
.
.
</logic:equal>
<logic:notEqual name="foo" property="bar" value"baz">
.
.
.
</logic:notEqual>

I'd like to propose (and would be willing to code) the following:
<logic:equal name="foo" property="bar" value"baz">
.
.
.
<logic:else>
.
.
.
</logic:else>
</logic:equal>


What do people think?
James

_________________________________________
James 
ICQ#: 8239923
More ways to contact me: http://wwp.icq.com/8239923
See more about me: http://web.icq.com/whitepages/about_me?Uin=8239923
_________________________________________



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Proposed: logic:else clause

Posted by Ted Husted <hu...@apache.org>.
If you wrote a patch and it worked, there'd be no technical reason to 
veto it. But since it is a straight-line convenience enhancement, it 
would have to wait for Struts 1.2.x.

The general feeling has been, as others have expressed, that it would be 
better to put development effort into libraries like Struts-el or (the 
upcoming) Struts-jsf, rather than then venerable logic tags.

But, as a Committer, you can choose your own priorities =:0), and, as 
mentioned, it would be hard to find a technical reason to block such a 
patch.

I don't know what IDE you are using, but another way to go would be to 
define a macro or template that filled out the equal/notEqual stuff for 
you.

-Ted.

James Turner wrote:
> I find in my code, I do the following a lot:
> 
> <logic:equal name="foo" property="bar" value"baz">
> .
> .
> .
> </logic:equal>
> <logic:notEqual name="foo" property="bar" value"baz">
> .
> .
> .
> </logic:notEqual>
> 
> I'd like to propose (and would be willing to code) the following:
> <logic:equal name="foo" property="bar" value"baz">
> .
> .
> .
> <logic:else>
> .
> .
> .
> </logic:else>
> </logic:equal>
> 
> 
> What do people think?
> James
> 
> _________________________________________
> James 
> ICQ#: 8239923
> More ways to contact me: http://wwp.icq.com/8239923
> See more about me: http://web.icq.com/whitepages/about_me?Uin=8239923
> _________________________________________
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Proposed: logic:else clause

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "James" == James Turner <tu...@blackbear.com> writes:

    James> I find in my code, I do the following a lot:
    James> <logic:equal name="foo" property="bar" value"baz">
    James> </logic:equal>
    James> <logic:notEqual name="foo" property="bar" value"baz">
    James> </logic:notEqual>

    James> I'd like to propose (and would be willing to code) the following:
    James> <logic:equal name="foo" property="bar" value"baz">
    James> <logic:else>
    James> </logic:else>
    James> </logic:equal>

    James> What do people think?

I think the trend is to avoid implementing features which are easily supplied
in the JSTL.  This is easily done with an arrangement of "c:choose", "c:when",
and "c:otherwise" tags.  This doesn't help people who are forced to use
containers only supporting Servlet 2.2.  Hopefully that set is becoming smaller
and smaller.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Proposed: logic:else clause

Posted by "V. Cekvenich" <vc...@basebeans.com>.
Lets say you want to do a mullit row display or update of the html tag.
If you nest it in logic iterate it works!
If you nest it in c:for each or similar, it throws an exception that 
indexed property only works in logic tag nesting.
So one day.... this needs to be fixed in all the html tags or maybe even 
in JSTL, if Struts one day decides to move to JSTL instead of logic.
.V

David M. Karr wrote:
>>>>>>"V" == V Cekvenich <vc...@basebeans.com> writes:
>>>>>
> 
>     V> The onlye thing that most html-el tags need to be modified to support indexed
>     V> property in JSTL, so we can do multi row updates.
> 
>     V> But that is post 1.1 I am sure.
> 
>     V> .V
> 
> What do you mean, Vic?  I'm using the same EL engine that the JSTL uses.  What
> exactly do you think is missing?
> 
>     V> Hal Deadman wrote:
>     >> I think the faster everyone moves from "logic" tags to JSTL the happier
>     >> everyone will be. The JSTL choose tag already supports if/elseif/else. The
>     >> expression language in JSTL makes logic easy that would be nasty with the
>     >> various logic tags.
>     >> <c:choose>
> 
>     >> <c:when test="${foo.bar eq 'baz'}">
>     >> ...
>     >> </c:when>
>     >> <c:otherwise>
>     >> ...
>     >> </c:otherwise>
>     >> </c:choose>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Proposed: logic:else clause

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "V" == V Cekvenich <vc...@basebeans.com> writes:

    V> The onlye thing that most html-el tags need to be modified to support indexed
    V> property in JSTL, so we can do multi row updates.

    V> But that is post 1.1 I am sure.

    V> .V

What do you mean, Vic?  I'm using the same EL engine that the JSTL uses.  What
exactly do you think is missing?

    V> Hal Deadman wrote:
    >> I think the faster everyone moves from "logic" tags to JSTL the happier
    >> everyone will be. The JSTL choose tag already supports if/elseif/else. The
    >> expression language in JSTL makes logic easy that would be nasty with the
    >> various logic tags.
    >> <c:choose>

    >> <c:when test="${foo.bar eq 'baz'}">
    >> ...
    >> </c:when>
    >> <c:otherwise>
    >> ...
    >> </c:otherwise>
    >> </c:choose>

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Proposed: logic:else clause

Posted by "V. Cekvenich" <vc...@basebeans.com>.
The onlye thing that most html-el tags need to be modified to support 
indexed property in JSTL, so we can do multi row updates.
But that is post 1.1 I am sure.

.V

Hal Deadman wrote:
> I think the faster everyone moves from "logic" tags to JSTL the happier
> everyone will be. The JSTL choose tag already supports if/elseif/else. The
> expression language in JSTL makes logic easy that would be nasty with the
> various logic tags.
> 
> <c:choose>
> <c:when test="${foo.bar eq 'baz'}">
> ...
> </c:when>
> <c:otherwise>
> ...
> </c:otherwise>
> </c:choose>
> 
> http://www.manning.com/bayern/appendixA.pdf
> 
> 
> 
>>-----Original Message-----
>>From: James Turner [mailto:turner@blackbear.com]
>>Sent: Friday, January 03, 2003 4:44 PM
>>To: struts-dev@jakarta.apache.org
>>Subject: Proposed: logic:else clause
>>
>>
>>I find in my code, I do the following a lot:
>>
>><logic:equal name="foo" property="bar" value"baz">
>>.
>>.
>>.
>></logic:equal>
>><logic:notEqual name="foo" property="bar" value"baz">
>>.
>>.
>>.
>></logic:notEqual>
>>
>>I'd like to propose (and would be willing to code) the following:
>><logic:equal name="foo" property="bar" value"baz">
>>.
>>.
>>.
>><logic:else>
>>.
>>.
>>.
>></logic:else>
>></logic:equal>
>>
>>
>>What do people think?
>>James
>>
>>_________________________________________
>>James
>>ICQ#: 8239923
>>More ways to contact me: http://wwp.icq.com/8239923
>>See more about me: http://web.icq.com/whitepages/about_me?Uin=8239923
>>_________________________________________
>>
>>
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail:
>><ma...@jakarta.apache.org>
>>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Proposed: logic:else clause

Posted by Hal Deadman <ha...@Tallan.com>.
I think the faster everyone moves from "logic" tags to JSTL the happier
everyone will be. The JSTL choose tag already supports if/elseif/else. The
expression language in JSTL makes logic easy that would be nasty with the
various logic tags.

<c:choose>
<c:when test="${foo.bar eq 'baz'}">
...
</c:when>
<c:otherwise>
...
</c:otherwise>
</c:choose>

http://www.manning.com/bayern/appendixA.pdf


> -----Original Message-----
> From: James Turner [mailto:turner@blackbear.com]
> Sent: Friday, January 03, 2003 4:44 PM
> To: struts-dev@jakarta.apache.org
> Subject: Proposed: logic:else clause
>
>
> I find in my code, I do the following a lot:
>
> <logic:equal name="foo" property="bar" value"baz">
> .
> .
> .
> </logic:equal>
> <logic:notEqual name="foo" property="bar" value"baz">
> .
> .
> .
> </logic:notEqual>
>
> I'd like to propose (and would be willing to code) the following:
> <logic:equal name="foo" property="bar" value"baz">
> .
> .
> .
> <logic:else>
> .
> .
> .
> </logic:else>
> </logic:equal>
>
>
> What do people think?
> James
>
> _________________________________________
> James
> ICQ#: 8239923
> More ways to contact me: http://wwp.icq.com/8239923
> See more about me: http://web.icq.com/whitepages/about_me?Uin=8239923
> _________________________________________
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>