I want a servlet to print the parameters from a html form but in the servlet the request has no parameters.
<form method="post" action="LoginServlet" >
<input type="text" name="username" id="username" /><br/>
<input type="text" name="password" /><br/>
<input type="submit" />
</form>
and the servlet's doPost():
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("POST");
HttpSession session = request.getSession();
String redirectUrl;
Enumeration atributes = request.getAttributeNames();
while (atributes.hasMoreElements()) {
System.out.println((String )atributes.nextElement()+ ".");
}
String user = (String) request.getAttribute("username");
String pass = (String) request.getAttribute("password");
System.out.println("user:" + (String) request.getAttribute("username"));
}
So it doesn't output any parameters and the username parameters is NULL.