• 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:

doubt in getParameter()

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

1.how 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?

3.how 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.

by
sivakumar
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


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


regards
Kanthi
 
Sivakumar Janardhanan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got it from other site.anyway thanks
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String sexL = (String )request.getParameter("sex");
if(sexL.equals("male"))
{
//action
}
else
{
//action if input radio button is female
}
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic