• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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.
 
Oh the stink of it! Smell my tiny ad!
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic