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 ?
Now I've never used that second line in any of my JSP's - and I've never
experienced any problems.
Am I missing something ?
cheers,
Andy
Re:
Posted by William Brogden <wb...@bga.com>.
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