On Tue, 11 Jun 2002 [EMAIL PROTECTED] wrote: > Hi > > I'm not quite sure how JSTL handles methods that return boolean values. As > far as I remember, if my JSP template contains something like > > <c:if test="${nose.isRed}"> > > then JSTL calls the method isRed() instead of getIsRed(). > > My tests however don't seem to affirm this, so I'm unsure how this is > handled.
It's handled according to the JavaBeans spec; in other words, there is already a convention present. The boolean property 'red' corresponds to the Java method isRed() that returns a boolean. > >From my point of view, the ideal solution would be like this: > - For normal attributes, JSTL looks for the appropriate getter, e.g. > nose.color calls getColor(). > - For boolean attributes, i.e. the ones used in c:if, JSTL looks for the > method with exactly the same name, e.g. nose.isRed calls isRed(). Just use nose.red instead of nose.isRed; this is the standard solution, and we don't want to come up with a new one arbitrarily. -- Shawn Bayern "JSTL in Action" http://www.jstlbook.com (coming in July 2002 from Manning Publications) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>