A question about beans and how they are set from <FORM> variables.  And
how to do it all properly....

The following works -- I have a bean which has a "String getCountry()"
and "void setCountry(String)" pair.  My HTML FORM looks something like
this:

<select name="country">
<OPTION VALUE=1> Afghanistan
<OPTION VALUE=2> Albania
<OPTION VALUE=3> Algeria
<OPTION VALUE=242> American Samoa
<OPTION VALUE=4> Andorra
<!-- ...etc ... -->
</select>

It all works just fine with my JSP file:

<BEAN
        NAME="test"
        TYPE="TestClass"
        INTROSPECT="yes"
        CREATE="yes"
        SCOPE="request">
</BEAN>

(old style: I'm using GNUJSP)

My problem is that my "country" value is really an integer. My set and
get methods should really be: "int getCountry()" and "void
setCountry(int)".  But this doesn't work: the set() method is not
called, presumably because the bean mechanism thinks my FORM variable
"country" is a string.

And I can't mix the set() and get()s to have "void setCountry(String)"
with an "int getCountry()".  That would sort of be OK.  However,  the
setMethod() is not called.  Presumably because introspection has decided
it is a read-only property after finding the int getCountry....

Anyone want to offer an elegant way to handle this sort of thing?  Is
there something I have do something special with BeanInfo to get this
kind of thing to work?

Cheers
Richard

Get Your Private, Free Email at http://www.hotmail.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to