Not able to Login from a Servlet using j_security_check
Hi Everyone,
I am trying to login with the j_security_check through a Servlet. The below is the code I have in my Servlet.
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod(“http://localhost:4502/content/tuhin/home/j_security_check”);
postMethod.addParameter(“j_username”, “tuhin”);
postMethod.addParameter(“j_password”, “tuhin”);
postMethod.addParameter(“_charset_”, “UTF-8”);
httpClient.executeMethod(postMethod);
Now this code is returning 302 status code. That means its not failing, otherwise it should have returned 403.
But at the same time I can see its not logging in with the intended user.
Am I doing something wrong? Or there is any more steps that I am missing ?
Thanks and Regards
Tuhin