I am facing issues with struts html:radio tag. I need default radio button checked, not lose them when validation fails and also handle related form fields depending upon the radio button value selected - implemented using a multi-page form. I was having a look at the past postings on this forum and i found some help - http://www.coderanch.com/t/54565/Struts/html-radio
As per suggested, i have done the below:
1. struts-config.xml: in action tag, added name attribute with value corresponding to my formbean.
2. In Action class, when my jsp page is invoked via the *.do (note that the previous invoking jsp does not correspond to my formbean. For my functionality, i have a different formbean as compared to the formbean of the invoking jsp), in the execute method i have retrieved MyForm from the ActionForm and explicitly set the default value on the radio button (setter).
Now: When my jsp is finally displayed, it shows the 2 radio buttons with one of them checked as the default value (as set in my Action Class).
I am keeping the form in session scope (struts-config.xml). I do not have reset method implemented. I did try and add the reset method and in that method, i set the radio button value to empty String (""), but this did not work (no radio button was selected when the jsp page was displayed he first time).
Let me know if any other information is required.
Any help would be be greatly appreciated as i have struggled with this the entire day..
Thanks in advance,
Joined: Feb 15, 2005