I am using Spring 1.2.7, Hibernate 3 and Apache Tomcat 5.5.
I have created simple user registration page having different fields like email Address, First Name, Last Name, Phone Number, Zip Code etc.
The problem is, one the field (Integer phonenumber) of bean doesn't get set when I hit the submit button of JSP page.
-- I have checked Spring binding on JSP.
-- I have checked field name (phonenumber) twice.
I am also using one validator class for this registration form. In that class I am trying to print the value of different fields. I get values of all the fields except phonenumber.
Here is some debugging from my side.
1) I have kept SOPs (System.out.Println) in setter method of phonenumber and it gets called when I start the tomcat.
2) Setter method of all the fields get called when I hit the submit button and before going to validator class.
Read about binding numbers on command objects. You'll need to set up a CustomNumberEditor in the initBinder() method of your controller. (Also, there's not really any reason to treat phone number as a Integer - String is fine, because even though a phone number is made up of numerical characters, you'll never do any mathematical computations on them. And there may be additional requirements related to formatting, international numbers, extensions, etc.)
Write once, run anywhere, because there's nowhere to hide! - /. A.C.