Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

radiobutton problem

 
sangeetha balasubramaniam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,

i have two radio button,i have to select one as a default.this has to be handled using struts.please help me...........
 
Roel De Nijs
Sheriff
Posts: 10230
129
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in your form:
private Collection allRadioValues;
private String radioValue = "1";
public Collection getAllRadioValues(
allRadioValues = new ArrayList();
allRadioValues.add(new LabelValueBean("1", "1"));
allRadioValues.add(new LabelValueBean("2", "2"));
);
public void setAllRadioValues(Collection c);
public String getRadioValue();
public void setRadioValue(String value);

in your jsp:
<c:forEach items="${nameForm.allRadioTypes}" var="radiotype" varStatus="radiotypeStatus">
<html-el:radio property="radioValue" value="${radiotype.value}"><bean:write name="radiotype" property="label" /></html-el:radio>
</c:forEach>

Hope this helps
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In ur jsp:
<html:radio property="Gender" value="M"/>Male
<html:radio property="Gender" value="F"/>Female

And thatthe Gender property on the form bean should have been already set to "M" then radio button with the text Male would be checked.

Hopes this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic