request parameter is taking null value in servlets
Posted
by Dusk
on Stack Overflow
See other posts from Stack Overflow
or by Dusk
Published on 2010-03-31T09:37:58Z
Indexed on
2010/03/31
9:43 UTC
Read the original article
Hit count: 438
Hi,
I want to know how can I get the value of the request parameters "j_username" and "j_password"?
After successfully login using form based authentication, I want my servlet to get the value of parameters "j_username" and "j_password", but I'm getting null as the value in both parameters. Could anyone please tell me how can I get the actual value of both paramters?
Servlets class :
package foo;
import javax.servlet.http.*;
import javax.servlet.*;
public class RequestHandler extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
{
try
{
String user = request.getParameter("j_username");
String password = request.getParameter("j_password");
response.getWriter().println(user+" "+password);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
output: null null
© Stack Overflow or respective owner