hi anthony
can u describe ur situation more? because there are ways to do "auto form submission".
1. if u have access to write an HTML which can get submitted to the destination servlet then u can write document.YourFormName.submit() on onLoad() method of the BODY tag and fill the form parameters already (hard-coded) so when u open the HTML having that form it will get automatically submitted....
2. if u have to write the multiple set of such forms (to automate the bulk submission) then,
-u can write a
jsp in which u will embed a form,
-pass ur form input parameters to that JSP which will fill the form paramters
-and have the document.YourFormName.submit() on onLoad() the same way as in option-1 above.
3. if u completely want to get rid of this kind of HTML or JSP then u can write a java program which is getting input parameters from some stream and then use the following code to prepare the request query
string that is to be passed to the servlet and then use URLConnection to the servlet to write to its outputstream,
public void sendPostMessage(Properties p) throws Exception{
String argString="";
if ( p != null ) {
argString = toEncodedString(p);
}
}
public String toEncodedString(Properties p) {
StringBuffer bf = new StringBuffer();
Enumeration names = p.propertyNames();
while(names.hasMoreElements()) {
String name = (String)names.nextElement();
String value = p.getProperty(name);
bf.append(URLEncoder.encode(name)+"="+URLEncoder.encode(value));
if ( names.hasMoreElements() )
bf.append("&");
}
return bf.toString();
}
(if u do it this way then the servlet will recieve the request in its doPost method)
hope this was little helpful.
let me know if i missed ur point anywhere...
regards
maulin