Hi All,

I was having a problem trying to get and set the value of a bean that
wasn't a string. I was getting a jsp runtime error as it instatiated the
bean. I checked the "Expanded Syntax Reference" supplied by sun and it
says
<QUOTE>
The values of the request parameters are always of type String. The
String values are converted to other data types  so they can be stored
in Bean properties. The allowed Bean property types and their conversion
methods are shown in    TABLE 1-1.

     How <jsp:setProperty> Converts Strings to Other Values
<TABLE 1-1>
Property Type--String Is Converted Using
boolean or Boolean--java.lang.Boolean.valueOf(String)
 integer or Integer-- java.lang.Integer.valueOf(String)
 float or Float-- java.lang.Float.valueOf(String) ............etc.
</TABLE 1-1>
</QUOTE>

I then discovered that changing the form from <INPUT TYPE="hidden".....>
to
<INPUT TYPE="text" ......> removed the error.

Q: Do jsp pages handle hidden inputs differently or this this a bug of
jswdk1.0.
Q: How do other servlet engines handle hidden form inputs (I'm going to
move my jsp's to apache jserv/Gnujsp as soon as we figure out how to get
those working.)

I'm using JDK1.7b and jswdk1.0.
I cannot just use String getter and setters as I'm using the java type
dynamically elsewhere in my code. I have coded a workaround, however I'm
not happy with it as I'm having to check for nulls and write way to much
additional code..
from
<INPUT TYPE="text" NAME="recNo"  Value="<jsp:getProperty
name="FurnetUser" property="recNo"/>" >
to
<%! String newAutoNumber=null;%>
code to get value of set newAutoNumber from another bean
if(newAutoNumber!="null"){
FurnetUser.setRecNo(Integer.parseInt(newAutoNumber));
}
and then
<%

if(newAutoNumber!="null"&&newAutoNumber!=""){
%>
<INPUT TYPE="hidden" NAME="recNo"  Value="<%= newAutoNumber%>" >
<%
}
 %>

Any suggestions would be greatly appreciated.
Regards Coral
begin:vcard
n:Emmerich;[EMAIL PROTECTED]
tel;cell:082 557 1870
tel;fax:(012) 668-1591
tel;work:(012) 668-1591
x-mozilla-html:FALSE
org:Nexus Medical
version:2.1
email;internet:[EMAIL PROTECTED]
adr;quoted-printable:;;PO Box 8581=0D=0AHalfway House=0D=0A1685;Johannesburg;Gauteng;;
x-mozilla-cpt:;-3120
fn:[EMAIL PROTECTED]
end:vcard

Reply via email to