I'm trying to Login in a .jsf intranet page, here is part of it:
<form method="POST" action="j_security_check" name="loginForm" id="loginForm">
<input name="j_username" type="text" class="textbox" maxlength="30"/>
<input name="j_password" type="password" class="textbox" maxlength="30"/>
<input type=submit value="Enter" class="button">
<input type=submit value="Exit" class="button">
</form>
I've searched and tryied something like this at java, but it didn't worked, I get the same page as result:
HttpPost post = new HttpPost("http://xxxx/login.jsf");
List <NameValuePair> parameters = new ArrayList <NameValuePair>();
parameters.add(new BasicNameValuePair("j_username", "92232776"));
parameters.add(new BasicNameValuePair("j_password", "(7110oi14)"));
UrlEncodedFormEntity sendentity;
sendentity = new UrlEncodedFormEntity(parameters, HTTP.UTF_8);
post.setEntity(sendentity);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post, httpContext);
System.out.print(convertInputStreamToString(response.getEntity().getContent()));
(I'm using httpcomponents-client-4.2)
What I need to do to login in this page? is there anything I need to do with the code button "Send"?
Thank you guys.