aspose file tools*
The moose likes Struts and the fly likes struts2: setting string value to int field of a bean does not throw any exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2: setting string value to int field of a bean does not throw any exception" Watch "struts2: setting string value to int field of a bean does not throw any exception" New topic
Author

struts2: setting string value to int field of a bean does not throw any exception

vikas byn
Ranch Hand

Joined: Mar 18, 2011
Posts: 80
I had a jsp which has a field user age.
age: <s:textfield name="user.age" id="user.age" ></s:textfield>

in action class, i have i create user bean getter and setter.

it works fine if i enter age as integer but if i enter string for age then it does not throw any exception.

where is the problem?
Tomas Bilek
Greenhorn

Joined: Nov 17, 2011
Posts: 5
If I understand correctly the problem, use validation.

http://struts.apache.org/2.x/docs/validation.html

Tomas Bilek
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts2: setting string value to int field of a bean does not throw any exception