tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Borislav Iordanov" <boris...@speakeasy.net>
Subject RE: RE: If/Else tag?
Date Sun, 10 Jun 2001 23:40:04 GMT
RE: RE: If/Else tag?Hi,

Ok, this I can understand. If tags (somehow) can be easier to use for non Java programmers,
assuming that they won't have to write complicated predicates, or otherwise the whole of Java
will have to be rewritten with XML syntax. I guess that's why I think specific conditional
tags (like testing request parameters, DB values, bean properties etc..) make more sense.
Code like:

<lib:if>
  <lib:condition>
       <lib:or>
           <req:param name="type" value="car"/>
           <req:param name="type" value="plane"/>
       </lib:or>
  </lib:condition>
  <lib:then>
    ....
  </lib:then>
</lib:if>

would be horrible ;)

Thanks for your responses,
Borislav
  -----Original Message-----
  From: Dave Newton [mailto:dave@solaraccess.com]
  Sent: Sunday, June 10, 2001 5:15 PM
  To: taglibs-user@jakarta.apache.org
  Subject: RE: RE: If/Else tag?


  The other issue here is programmer-vs.-designer people who might work on a page.
  I'd rather give a designer something that looked like HTML, something they're used
  to, than have to introduce any of several Java programming constructs.
   
  That said, I have a heavy mix of both custom tags and scriptlets on our site because
  a) I'm also one of the designers and I can get away with it and b) sometimes it's quicker
  to do a scriptlet than generalize functionality into a tag.
   
  Dave
  --
  Dave Newton, dave@solaraccess.com


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


    Some people, myself included, for the sake of uniformity and design, would like to maximize
the usage of XML-like JSP tags.   I would love if all my server-side java code could be either
packed away behind beans, or hidden behind XML-like JSP tags.  I think all of us would love
this also, though sometimes this is not feasible.

    Brett
      -----Original Message----- 
      From: Borislav Iordanov 
      Sent: 2001-06-06 (수) 오후 8:55 
      To: taglibs-user@jakarta.apache.org 
      Cc: 
      Subject: RE: RE: If/Else tag?


      Hi,

      I'm just wondering, what's wrong with scriplets. I'm really failing to find any value
in a tag "replacement" of the usual and natural Java if statement. It seems to me that the
useful conditional tags are the ones with some predefined and parametrizable (in a simple
way) conditions, like the <req:ifParameter name="..." value="..."> and even then....
what's the point? Is it just that for you something like:

      <utils:if predicate='<%= ... %>'>
      </utils:if>

      looks better than

      <% if (....) %>
      <% } %>

      Just asking, because I'm really wondering whether there's some inherent advantage in
having tags instead of scriplets, or it's simply a matter of personal taste and some prefer
writing tags.

      Borislav

      -----Original Message-----
      From: Amos Shapira [mailto:amos.shapira@webcollage.com]
      Sent: Tuesday, June 05, 2001 2:12 AM
      To: 'taglibs-user@jakarta.apache.org'
      Subject: RE: RE: If/Else tag?


      Sorry, but if the purpose of taglibs is, among other things,
      to make the code more readable and maintainable then such
      tricks are not helping this goal, IMHO.

      Also - what about nested "if/else"?

      Starts to look like old-fasioned basic to me (the one on
      Genie II and XT ROM Basic, not Visual Basic) :-)

      I'll stick to scriptlets for now, as much as I'd like to
      avoid them.

      Cheers,

      --Amos

      -----Original Message-----
      From: Mikko Kurki-Suonio [mailto:maxxon@neuslab.fi]
      Sent: Tuesday, June 05, 2001 8:45 AM
      To: 'taglibs-user@jakarta.apache.org'
      Subject: Re: RE: If/Else tag?


      On Tue, 5 Jun 2001, [utf-8] Amos Shapira wrote:

      > 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).

      Simple. Just set a DIFFERENT flag variable whenever you trip the "real IF"
      and test the _flag_ for the "ELSE".

      In pseudocode:

      x_else_flag = true;

      if x then x_else_flag = false; blah blah blah;
      if x_else_flag then do_the_else_thingy;

      //Mikko





Mime
View raw message