This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes doubt in getParameter() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "doubt in getParameter()" Watch "doubt in getParameter()" New topic

doubt in getParameter()

Sivakumar Janardhanan
Ranch Hand

Joined: Dec 11, 2008
Posts: 30
Hi everybody, i have created one jsp page and have written the server side code in servlet.

In the jsp page i have declared two radio button like this
<input type="radio" name="sex" value="male">Male<br />
<input type="radio" name="sex" value="female">Female<br />

here name parameter is a radio button group name. so we can select any one radio button at a time.

Now i write the servlet code for reading the textfield value only.

But my question is can i read the radio button value/name?(you assume that if i click the male radio button in my jsp loginform what value/name returns to getParameter() method).

2. how to rectify which radio button is checked? to write the condition(male or female) for radio button in servlet code?

please any one tell me detailed answer for this question. because i am very confused.

kranti kumar

Joined: Dec 31, 2008
Posts: 10

you can try this as usual like request.getParameter("sex");

then coming to your concern, we are able to select only one button at time. so it doesnot make any confusion.

I think it clarifies your concern

Sivakumar Janardhanan
Ranch Hand

Joined: Dec 11, 2008
Posts: 30
i got it from other site.anyway thanks
kranthi adari

Joined: Dec 29, 2008
Posts: 21
String sexL = (String )request.getParameter("sex");
//action if input radio button is female

jQuery in Action, 2nd edition
subject: doubt in getParameter()
Similar Threads
form in multilingual
radio buttons
problem in database
how to check the radio button using javascript?
code attached element existance in javascript