Bug 16590 - Expression language incorrectly treating missing properties on beans as null.
Summary: Expression language incorrectly treating missing properties on beans as null.
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2003-01-30 10:45 UTC by James Shade
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description James Shade 2003-01-30 10:45:45 UTC
N.B. This is in version 1.0.2 which isn't available in the version list on Bugzilla.

If I have a non-null bean "myBean" which does not contain a property "nonProperty", 

<c:out value="${myBean.nonProperty}"/> should throw an exception according to
the JSTL spec (see http://jcp.org/aboutJava/communityprocess/final/jsr052/ 
pages 2-11 and A-190).  

This is actually treated as a null value and the default is returned.  This
hides errors, since as the spec says "it's likely a typo or another mistake".
Comment 1 Shawn Bayern 2003-01-30 13:46:31 UTC
I can't replicate the problem, and indeed, this has always worked correctly in 
the Standard Taglib.

If you still believe it's a problem, check the following things, as others have 
run into them and misdiagnosed this as a bug:

1) Ensure you are using the Stadnard Taglib and not an alternative, container-
based implementation such as the one embedded in Resin.

2) Ensure that 'myBean' is truly non-null; for instance, ensure that it's not 
actually a scripting variable instead of a scoped variable.

3) Ensure that you're actually defining the "c" taglib with an appropriate <%@ 
taglib %> directive; if you don't, then <c:out ...> will be output to your 
page, but a browser won't display it; this causes many people to think that the 
tag has instead run but output nothing.

If none of these situations applies, then please post a full page that 
demonstrates the problem.
Comment 2 James Shade 2003-01-31 13:15:43 UTC
Thanks for the quick response, and apologies... it appears your first answer is
correct, I was using the resin implementation.  I hadn't realised this as it's
basically an undocumented (and it seems, unfinished) feature of resin which is
on by default and hijacks the implementation pointed to by the TLD.