How to make the radio button selected by default on page load
I am fetching some records from DB and storing that in bean and populating radio button values using <jsp:useBean id="sel" class="myTest.struts.bean.ViewForm" /> <html:radio property="select" value="<%= bean.getName()%>" ></html:radio> I am putting the value of first name in an hidded variable called 'val'
A common mistake with the <html:radio> tag is to misunderstand the "value" attribute. With this tag, the "value" attribute refers to the value that will be passed back from the form if the button is selected.
Check the html rendered from your jsp by using your browser's "view source" function. If the html for this button does not read value="selvi", then you know you haven't set up the value attribute properly.
If it does read value="selvi", then the problem is likely to be with the form bean not being populated correctly.
Here is a link to the documentation on the <html:radio> tag.