jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bergsten <h...@gefionsoftware.com>
Subject Re: Lack of good error message
Date Thu, 31 Jul 2003 22:27:37 GMT
Eric W Hauser wrote:
> I posted this to taglibs-user, but it's probably better suited for here.
> I was wondering about the lack of a useful error message when JSTL
> attempts to call a accessor that does not exist.  For instance, calling an
> EL expression like ${bean.name} where getName() does not exist in the bean
> class.  In this instance, this is just ignored and nothing is output.  I
> can see the argument for this, but I also can see the argument for a
> JspException in this case.  At least, would it not be useful to include
> the option of turning this on a context parameter?  One of my only
> complaints about JSTL is the fact that it is difficult to debug because of
> this.

${bean.name} does give you a JspException, if "bean" is a bean and it
doesn't have a public getName() method. If "bean" is a Map, though, you
don't get an exception. This inconsistency was made to avoid having to
deal with exceptions in the very common case of using a request parameter
value that may or may not be present, e.g.:

   <input name="foo" value="${param.foo}">

in a JSP 2.0 container. If an exception was thrown when "foo" isn't
present, you would have to wrap this whole thing in lots of code testing
if it's there.

So, if you don't get an exception for the bean property case, it's a
bug. I've tested with both Standard 1.0.1, and it works as it should.

Hans
-- 
Hans Bergsten                                <hans@gefionsoftware.com>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Mime
View raw message