• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 Radio Button Selected value

 
Joe Harry
Ranch Hand
Posts: 10114
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have the following struts tag to iterate the options and display them as a radio button:



How do I get the value of the radio button that the user selected in my action class? Is there a Struts way of doing that? Or should I use the HttpServletRequest#getParameter methods?
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,

You can simply display the value of radio button with


Regards
Jatan
 
Joe Harry
Ranch Hand
Posts: 10114
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I would like to have that value in my action class. I'm using jQuery ajax function to do the form submit. Here is the jQuery function:



As you can see, I'm serializing the data as per the documentation from jQuery. But I see nothing in my action class.
 
Joe Harry
Ranch Hand
Posts: 10114
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found out the issue. The div element that contains the radio buttons was not inside the s:form tag. Once I had them inside, it started working!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic