Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts and ajax

 
mitforu patel
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using struts 1.2 frame work. I need to implement a feedback functionality. I have 3 radio button and I need to make a ajax call to send the value of the radio button while click on submit button.

I am not sure that do I need to have a bean defined with the property to hold the value for those radio button as the property value of strut radio button is required. Is there any way that when I click the button I can fetch the value of radio button using java script and make a ajax call?

can any body help?

Thank you,
Mit
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mit,
Why do you prefer AJAX here, Is that a requirement that you do not want to reload the page? If yes, only then go for ajax and there are two ways

1. Using struts Framework: You can use a form property in form bean and define the radio buttons using html tags. In the javascript method of your submit user document.MyForm.propertyName to get the value and use ajax from then
2. W/O struts: you can just dispaly the radio button as input type providing an ID and use document.getElementById('yourId') and pass it trough ajax (didnt try this method though)

I prefer the first way
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic