Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Error while validating the input

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens when "age" is an Integer (not int) field?
 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic