This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes struts and ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts and ajax" Watch "struts and ajax" New topic

struts and ajax

mitforu patel

Joined: Jan 13, 2010
Posts: 11
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,
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

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

Have Fun with Java
little,little.. little by little makes a lot..
I agree. Here's the link:
subject: struts and ajax
It's not a secret anymore!