jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdela...@us.britannica.com
Subject RE: taglib roadmap and practices
Date Fri, 22 Dec 2000 00:23:57 GMT

> -----Original Message-----
> From: Mike Cannon-Brookes [mailto:mcannon@internet.com]
> Sent: Thursday, December 21, 2000 6:05 PM
> To: taglibs-dev@jakarta.apache.org
> Subject: RE: taglib roadmap and practices
> Time for my $0.02 ;)
> << Joe's post snipped >>
> >
> > I agree with the above tag design philosophy for the 
> current JSP spec.
> > And this is how I tried to design the taglibs I have 
> written (and why my
> > TLD files have each tag configured with 
> <rtexprvalue>false</rtexprvalue>.
> IMHO this is silly (and I know we've clashed on this before 
> ;)). What you're
> doing here is governing the way people write their JSPs, 
> constraining them.
> What we should be doing is giving them options. (Without 
> wanting to start a
> flamewar) Look at Perl - TMTOWTDI - There's More Than One Way 
> To Do It!

To me, this is not a big deal.  The user can just change the TLD if they
want to use interpreted values.

> There's no reason for your tags (request etc) and for IN16's 
> (our mail tags
> etc) that you couldn't allow _both_ methods of doing it. That 
> way tools can
> still use the tags by generating verbose output, and people 
> like myself and
> Scott that aren't fearful of <% %> can have nice concise code?
> > If an attribute is something that would be set dynamically 
> in a JSP page
> > I feel it should have a corresponding tag that sets the 
> value using the
> > tags body content.
> >
> > The <jsp:setProperty ... /> is too limiting, it doesn't 
> allow you to set
> > a property dynamically using body content.  This brings up 
> the whole issue
> > of how to pass data between tags seamlessly. Passing property
> > values using
> > a tags body content involves alot of overhead. Other methods require
> > introspection and reflection which adds overhead. There 
> doesn't seem to
> > be a good solution right now that will allow different tag 
> sets to share
> > data seamlessly.
> How to pass data? Create a java object, and pass it with <%= 
> myobject %>.
> I've still yet to meet a web developer who doesn't understand 
> this simple
> little scriptlet, yet I've met hundreds of programmers who 
> throw their hands
> up and yell "What if they make a typo!".
> Introspection and reflection are too slow, agreed. Why don't 
> we just use the
> above? *sigh*

To me, it's more a question of elegance rather than difficulty.  Given these
two alternatives, I would much prefer option 2 (particularly since I can use
it in conjunction with custom tags), but it's not supported by the spec:

(#1: with scriptlets)
  String smtp-server = application.getInitParameter("smtp-server");
  String user = "joeo";
  String password = "blankman";
  String subject = "An email for " + userName;
  String body = "This is a test.";
<mail:send id="mail">
  <jsp:setProperty name="mail" property="smtp-server"
  <jsp:setProperty name="mail" property="user" value="<%=user%>"/>
  <jsp:setProperty name="mail" property="password" value="<%=password%>"/>
  <jsp:setProperty name="mail" property="to" value="<%=userEmail%>"/>
  <jsp:setProperty name="mail" property="subject" value=<%=subject%>"/>
  <%-- a separate tag for the body eliminates unwanted whitespace --%>
  <jsp:setProperty name="mail" property="body" value="<%=body%>"/>

(#2: jsp:setProperty tags - not supported by spec)
<mail:send id="mail">
  <jsp:setProperty name="mail"
  <jsp:setProperty name="mail" property="user">joeo</jsp:setProperty>
  <jsp:setProperty name="mail"
  <jsp:setProperty name="mail"
  <jsp:setProperty name="mail" property="subject">An email for
  <%-- a separate tag for the body eliminates unwanted whitespace --%>
  <jsp:setProperty name="mail" property="body">This is a

Why not support both?

View raw message