On Mon, 18 Mar 2002, Dave Newton wrote:

> On Monday 18 March 2002 02:43 pm, you wrote:
> > > <c:if test="${securityBean.check(request, response) }">
> > The JSTL expression language does not support method invocations on
> > objects.  You'll currently need to use a custom tag library or scriptlet
> > code (with the former being recommended over the latter) if you want to
> > access arbitrary methods and pass arguments to them.
> 
> So, from a non-current tag/etc. user does this mean that I'd either
> want a custom tag for All Things Like That (i.e., <c:ifsecurecheck
> ...>) or, perhaps more OOish, <c:ifcheck param=MyBean> and use
> reflection to call a common method for everything I'd ever want to
> .check?

Tags are a great mechanism for providing abstraction.  If you want a
facility to call arbitrary methods from within a JSP page, Java scriptlets
(<% %>) provide this already.  Scriplets' problems don't just stem from
their syntax; they tend to make pages harder to maintain because they
don't create any meaningful abstraction.

Tags do.  When you design tags, I simply recommend you choose the most
convenient abstraction for your users.

There's a theory in linguistic pragmatics (for actual human languages, not
CS languages) that suggests language is a tradeoff between laziness and
effectiveness; as a speaker, you want to be lazy, but as a listener, you
want the speaker to provide as much information as is necessary.  Since
everyone is both a speaker and a listener, languages end up being
balanced:  not too verbose or too clipped, on average.

Anyway, page authors and tag-library developers are in a similar
relationship.  For every environment, there's a particular level of
"verbosity" that's appropriate; one isn't necessarily better than others.  
JSTL works well with either approach; it encourages good design when
unambiguous, but otherwise tries to avoid preaching about how you must
design your applications.

--
Shawn Bayern
Author, "JSP Standard Tag Library"  http://www.jstlbook.com
(coming this summer from Manning Publications)


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to