http will always pass a string parameter so its generally better to make
your action form properties strings as well. The user could have typed
garbage into the form control so the string that is passed might not be
parseable.

Best bet is to add an extra method to your action form that does the
conversion. One approach might be:

public Integer getIUserTypeInteger
{
  try
  {
    return Integer.parseInt( getIUserType() );
  }
  catch(Throwable t)
  {
    return null;
  }
}

Which will return you an Integer, or null if what the user typed wasnt
something that could be converted to an integer.

-----Original Message-----
From: Andy Cheng [mailto:[EMAIL PROTECTED]
Sent: Monday, 4 August 2003 17:52
To: [EMAIL PROTECTED]
Subject: Can


Is there anyway of having the code below to return int value? I have
variables that match the datatype in the database, and I really want to
keep it instead of having String methods in the form class and do
conversion everytime I need to read and modified using the get method.

<html:select property="IUserType">
<html:option value="1" >Type1</html:option>
<html:option value="2" >Type2</html:option>
<html:option value="0" >Type3</html:option>
</html:select>

Andy



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to