onload="document.forms[0].submit()"
in your form's body tag then something like
Code samples and other things I want to remember.
onload="document.forms[0].submit()"
PostMethod post = new PostMethod("http://jakarata.apache.org/");
NameValuePair[] data = {
new NameValuePair("user", "joe"),
new NameValuePair("password", "bloggs")
};
post.setRequestBody(data);
// execute method and handle any error responses.
...
InputStream in = post.getResponseBodyAsStream();
// handle response.
UsernamePasswordAuthHandler
edu.internet2.middleware.shibboleth.idp.authn.provider.UsernamePasswordLoginServlet
loginPage
specialPages/login.jsp
public void doPost() throws Exception {
try {
// Construct data
String data = URLEncoder.encode("j_username", "UTF-8") + "=" + URLEncoder.encode("test", "UTF-8");
data += "&" + URLEncoder.encode("j_password", "UTF-8") + "=" + URLEncoder.encode("test", "UTF-8");
// Send data
URL url = new URL("/specialpages/script.jsp");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
//// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
System.out.println(line);
}
wr.close();
rd.close();
} catch (Exception e) {
}
}