I need to get value of dropdown list, radio button and a check box. I am using request.getParameter()
method but it's returning null
value.
JSP Code:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="trial.jsp" method="POST" enctype="multipart/form-data">
<table>
<tr>
<td class="entry">
Highest Qualification :
</td>
<td class="entry">
<select name="mon">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
</select>
<input type="submit" value="Submit" name="submit" />
</td>
</tr>
<tr>
<td class="entry">
<input type="radio" name="gender" value="Male" />Male
<input type="radio" name="gender" value="Female" />Female
</td>
</tr>
</table>
</form>
</body>
</html>
Servlet Code:
public class NewServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String bdate = null;
bdate = request.getParameter("mon");
System.out.print("This is" + bdate);
}
}