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 02:02:42 GMT
Hi Joseph,

In JSP 1.1, <jsp:getProperty /> and <jsp:setProperty /> were only guaranteed
to work for beans, but in JSP 1.2 they've expanded the definition so that
they work more generically:

  The value of the name attribute in jsp:setProperty and jsp:getProperty 
  will refer to an object that is obtained from the pageContext object 
  through its findAttribute() method. 

(I discovered this change to the spec when trying to get Jakarta tags to
work in Weblogic!)  The spec goes on further to point out that
jsp:setProperty and jsp:getProperty _are_ now applicable to custom tags:

  The object by the name must have been "introduced" to the JSP processor
  using either the jsp:useBean action or a custom action with an associated 
  VariableInfo entry for this name.

So the cat's out of the bag.  :)  jsp:setProperty and jsp:getProperty are
now legitimate accessories to custom tags, according to the spec.  And I'm
all for it, particularly in the way it has been implemented in many of the
Jakarta taglibs.  However, I think jsp:setProperty would be much more useful
if it included body content.

However, I guess that I'm slightly off-topic.  If you're looking for advice
for the JSR-052 spec, you're looking for input on standard tags that obey
the JSP 1.2 spec, while I'm talking about a proposed change in the JSP spec.
So, sorry for digressing!  I hope that the next JSP spec allows more
flexible usage, though.

> -----Original Message-----
> From: Joseph B. Ottinger [mailto:joeo@epesh.com]
> Sent: Thursday, December 21, 2000 7:26 PM
> To: taglibs-dev@jakarta.apache.org
> Subject: RE: taglib roadmap and practices
> 
> 
> This is getting too deep for convenient quoting!
> 
> I like the idea of using <jsp:setProperty /> for local tags,
> but... something in me rebels. It changes the focus of 
> setproperty from
> the page/session/application scope to include a tag scope, and while
> possibly workable, it doesn't seem very orthogonal.
> 
> Note that for the jakarta taglibs project, it doesn't matter WHAT *I*
> think - I'm a member of the list, not a committer or on any 
> boards here. I
> *am* on the JSR-052 committee, which was why I mentioned it 
> in the first
> thread, but it makes sense (to *me*, anyway, heh heh) to pay 
> attention to
> the body of work already existing... which means considering what Mike
> Cannon-Brookes and I (and others!) have done with the IN16 project on
> sourceforge, jakarta, and other possible contributors.
> 
> BTW, the roadmap I mentioned, while still VERY skimpy, can be found at
> http://epesh.com/tagroadmap.html :)
> 
> On Thu, 21 Dec 2000 mdelagra@us.britannica.com wrote:
> 
> > Hi all, 
> > 
> > Sorry for the truncation.  It a long thread! 
> > 
> > > ... 
> > > I agree as far as the coding target - the attributes are 
> > > familiar, they're 
> > > easier, they're shorter, they're far less likely to alienate 
> > > those who are 
> > > only HTML programmers and yet don't use tools to generate 
> > > everything. However... I don't think an additional 
> variable addressing
> > 
> > > scheme is good for JSP (<mail:send 
> to="$recipient">..</mail:send>), 
> > > although that *does* address one aspect of the need. 
> > > 
> > > The most direct solution is to relax the ability to use 
> tags inside 
> > > attributes where rtexprvalue is true; to wit: 
> > > 
> > > <mail:send 
> > >   to="<jsp:getProperty name="recipient" property="email" />" 
> > >   ... 
> > > > 
> > >   ... 
> > > </mail:send> 
> > > ... 
> > 
> > That's an interesting idea, although including tags within 
> attributes is
> > not very XML-like.  Another way to relax the spec, which would
> > accomplish the same end in many cases, would be to allow the
> > <jsp:setProperty ../> tag to have a body in lieu of a 
> "value" attribute.
> > Consider what kind of flexibility that would provide in 
> conjunction with
> > the TagExtraInfo interface:
> > 
> > <mail:send id="mail"> 
> >   <jsp:setProperty name="mail"
> > property="smtp-server"><DEFANGED_application:initparmeter
> > name="smtp-server"/></jsp:setProperty> 
> >   <jsp:setProperty name="mail" 
> property="user">joeo</jsp:setProperty> 
> >   <jsp:setProperty name="mail"
> > property="password">blankman</jsp:setProperty> 
> >   <jsp:setProperty name="mail"
> > property="to"><%=userEmail%></jsp:setProperty> 
> >   <jsp:setProperty name="mail" property="subject">An email for
> > <%=userName%></jsp:setProperty> 
> >   <%-- a separate tag for the body eliminates unwanted 
> whitespace --%> 
> >   <jsp:setProperty name="mail" property="body">This is a
> > test.</jsp:setProperty> 
> > </mail:send> 
> > 
> > Note that you get the flexibility of elements without 
> having to write
> > extra tags.  The lack of extra tags also makes it more IDE-friendly
> > (particularly for a Java-enabled IDE, which could retrieve 
> the potential
> > getter/setter properties via reflection).  The principal drawback is
> > that you can't use a TLD to insure that the configuration 
> parameters are
> > set at compile-time.
> > 
> > 
> 
> -----------------------------------------------------------
> Joseph B. Ottinger                           joeo@epesh.com
> http://epesh.com/                             IT Consultant
> 

Mime
View raw message