1

In HTML/JSP,

<input type="radio" value="10" name="a">10 Records
<input type="radio" value="20" name="a">20 Records
<input type="radio" value="50" name="a">50 Records 

In Servlet,

String val= request.getParameter("a");
System.out.println("Record is : "+val);

Variable val returns null .

3
  • Are you sure you have one selected when you submit? Commented Oct 30, 2014 at 17:11
  • how do you post it ? Commented Oct 30, 2014 at 17:11
  • yes it is one selected when i submit Commented Oct 30, 2014 at 17:12

3 Answers 3

3

Hope you have code similar to this then it'll give you value of a

<form action="/Servlet" method="post">
     <input type="radio" value="10" name="a">10 Records
     <input type="radio" value="20" name="a">20 Records
     <input type="radio" value="50" name="a">50 Records 
    // submit button here
</form>
Sign up to request clarification or add additional context in comments.

Comments

2

check whether your form specifies the method post. please refer below

<form action="/Servlet" method="post">
     <input type="radio" value="10" name="a">10 Records
     <input type="radio" value="20" name="a">20 Records
     <input type="radio" value="50" name="a">50 Records 
     <input type = "submit" value = "submit"/>
</form>

then it should work.

Comments

0

I face same problem. I try this then it works fine.

<input type="radio" value="10" name="a">10 Records **</input>**
<input type="radio" value="20" name="a">20 Records **</input>**
<input type="radio" value="50" name="a">50 Records **</input>**

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.