wood burning stoves 2.0*
The moose likes Spring and the fly likes NumberFormatException on using form:radiobuttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "NumberFormatException on using form:radiobuttons" Watch "NumberFormatException on using form:radiobuttons" New topic
Author

NumberFormatException on using form:radiobuttons

vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 191
i am using Spring 3.0

the below for loop in jsp is working fine:



but, when i replaced the for loop with form:radiobuttons tag as shown below:



it is giving the below error:



salary is of int type. please tell me, where i am going wrong? Thank you.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Because the list is in myList, not myList.salary.

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/view.html#view-jsp-formtaglib-radiobuttonstag
vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 191
Thank you Newton,

i tried this:



but this time, i am getting the below error:



Even though, myList is not null.

please help.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Is myList in the model object?
vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 191
myList is the object of Position class. and position is in the model object.

so, i understood my mistake and change the code as shown below:



but, i am getting this error now:

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Without the code (and possibly config) it's impossible to help: if you search the web for that specific exception you'll probably find out what you're doing wrong.
vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 191
thank you very much Newton. The issue is resolved now! I was using model.addAttribute(position) instead of model.addAttribute("position", position). Because my model object is position but model class is MyPosition.

I guess, i need to write a toString() method in User class to display the contents properly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NumberFormatException on using form:radiobuttons
 
Similar Threads
Iterating over Map using JSTL
JSTL problem
What is wrong in th code
how to send multiple data in a table in a mail application?
Not able to pass List values to view