Hmmm...  I'm sending this one more time as it hasn't appeared in the list as
of yet.
Apologies if two copies suddenly show up!

-----Original Message-----
From: Arun Thomas [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 07, 2000 10:04 AM
To: JSP Mail List
Subject: jsp:getProperty using is<Property> methods


Hello all,

I was reading through the excerpts from the book Drew mentions in his email
on the thread
"web app programming specifications query" (found at the site listed below)
when I came
across a section which caught my eye.... I've excerpted it below.

Where would this kind of thing come in useful?  Besides printing out either
"true" or "false", is there any way to take advantage of the boolean nature
of:

        <jsp:getProperty name="blah" property="aBoolean" />

assuming that this translates into a call to blah.isABoolean()?  As far as I
know, the
<jsp:getProperty> tag isn't allowed to have a body, which means there's no
way to do something
conditionaly based on the result of the getProperty.

Thanks very much!
-AMT

----------------------------------------------------------------------------
-----

Boolean properties

For boolean properties, that hold only true or false values, you can elect
to use another Bean convention for getter
methods. This convention is to prefix the property name with is, and return
a boolean result. For example, consider these
method signatures:
        public boolean isProperty();
        public boolean isEnabled();
        public boolean isAuthorized();

The container will automatically look for this form of method if it cannot
find a property access method matching the getter
syntax discussed earlier. Setting the value of a boolean property is no
different then the setter methods for other properties.
        public void setProperty(boolean b);
        public void setEnabled(boolean b);
        public void setAuthorized(boolean b);

----------------------------------------------------------------------------
-----

> Finally, I have recently reviewed an upcoming book from Manning Publishing
> called "Web Development with Java Server Pages" by Duane Fields and Mark
> Kolb.  This goes into some detail about web app architectures and
> includes a
> fairly thorough example of the using the command pattern with a single
> controlling servlet.  The book will be out in the next few months, but I
> think you can get a sneak peak at:
>
>   http://www.manning.com
>
> Regards
>
> Drew Cox
> Barrack Consulting

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to