This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Error while validating the input Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Error while validating the input" Watch "Error while validating the input" New topic
Author

Error while validating the input

MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
I have a model Person class which holds users input data



RegisterAction class which acts as an Action is



A form page register.jsp which asks for user input



struts.xml is configured as




If I feel out all the user input form fields, everything works fine but if I keep forms "Enter age" field blank, the framework throws exception
WARNING: Error setting expression 'beanPerson.age' with value '[Ljava.lang.String;@b6434f'
ognl.MethodFailedException: Method "setAge" failed for object Register.Model.Person@2ec5b6 [java.lang.NoSuchMethodException: Register.Model.Person.setAge([Ljava.lang.String;)]
Caused by: java.lang.NoSuchMethodException: Register.Model.Person.setAge([Ljava.lang.String;)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1206)

I am not able to figure it out, what is going wrong in this.


I am slow but sure
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What happens when "age" is an Integer (not int) field?
MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
Changing the type of age attribute from int to Integer and leaving the form field for age as blank now throws java.lang.NullPointerException in validate method
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while validating the input
 
Similar Threads
Error setting the expression with value [Ljava.lang.String;@1d05b0a
pass values between pages using Struts2
Integrating Struts 2 with Hibernate.
struts2 workflow question
Form Data not being populated in Struts 2