aspose file tools*
The moose likes Struts and the fly likes Using Struts Creating the Radio Button for gender Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Using Struts Creating the Radio Button for gender" Watch "Using Struts Creating the Radio Button for gender" New topic
Author

Using Struts Creating the Radio Button for gender

Jerlin Ong
Greenhorn

Joined: Nov 19, 2006
Posts: 1
When I coding for the radio button for the gender, i have conter a problem is that no getter method for property gender of bean. Besides this, I also have try it with the word like "Gender", "gen" and so on. But it also doesnt work.

Can anyone with this experiences before help me to solve the problem? Your suggestion will be appretiate.
Christian Nash
Ranch Hand

Joined: Jan 17, 2006
Posts: 107
Hi,

I am assuming that you have 2 radio buttons for Gender on your jsp and you want to get the value which is selected in the Action Class.

So here goes,
First in the ActionForm class,


Then in the jsp:
Gender
<input type="radio" name="gender" checked value="Male" />
<input type="radio" name="gender" value="Female"/>

Hope this solves the problem.


- Christian
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you use Struts tags instead of generic html tags, the buttons will be checked or unchecked based on the value of the ActionForm property. Example:

<html:radio property="gender" value="Male" />Male
<html:radio property="gender" value="Female" />Female


Merrill
Consultant, Sima Solutions
 
Don't get me started about those stupid light bulbs.
 
subject: Using Struts Creating the Radio Button for gender