A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
struts2: setting string value to int field of a bean does not throw any exception
Joined: Mar 18, 2011
Jan 24, 2012 02:31:34
I had a
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
for age then it does not throw any exception.
where is the problem?
Joined: Nov 17, 2011
Feb 03, 2012 08:02:26
If I understand correctly the problem, use validation.
I agree. Here's the link:
subject: struts2: setting string value to int field of a bean does not throw any exception
why getters/setters in java
How OGNL automatically maps to the appropiate Object
Avoiding Default primitive wrapper value display on JSF page
Error while validating the input
Struts2 very simple validation doesn't work
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014