• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

radiobutton problem

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...........
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic