tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Brogden <wbrog...@bga.com>
Subject Re: <jsp:setProperty
Date Tue, 02 May 2000 12:41:35 GMT


Andy Cathrow wrote:
> 
> If this is a bit off topic - then I apologise .....
> 
> I've been using Tomcat (and prior to that WebSphere) for quite some time
> now - without any difficulties.
> Looking through the samples - there is one thing I could never understand
> 
> Looking at the colors sample shipped with Tomcat ......
> 
> <jsp:useBean id="cb" scope="session" class="colors.ColorGameBean" />
> <jsp:setProperty name="cb" property="*" />
> 
> I don't understand the purpose of the setProperty line - what's it for ?
> Does it call the set routines for all properties ? Does it call the
> constructor ?

It is a shorthand way of calling the set methods of the ColorGameBean
with the parameters and values in the request object. Naturally this
assumes you named the parameters and the set methods to fit the
convention.
So, if your form has:
<input name="numb" type="text" size="10">

Your bean needs to have  setNumb( String s);
       note the case -------^
WBB

Mime
View raw message