Reputation: 21
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
.
Upvotes: 1
Views: 13228
Reputation: 1
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>**
Upvotes: 0
Reputation: 2189
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.
Upvotes: 2
Reputation: 3916
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>
Upvotes: 3