Hi,
I am using httpclient to post some data to a website.
The actual url that I am trying to post to is http://www.amfiindia.com/navreport.asp
The asp page corresponding to the form is given below
-------navreport.asp------begin--------
<form name="abc" method="post" action="navreport.asp">
<select size="1" name="cmbmf">
<option value="all">ALL</option>
<option value=39>abc</option>
...
</select>
<input type="submit" value="View" name="abcv" onclick="location.replace('#123')">
-------navreport.asp------end----------
I use the following code:
String url = "http://www.amfiindia.com/navreport.asp";
HttpClient client = new HttpClient();
PostMethod method = new PostMethod( url );
method.addParameter( "cmbmf", "all" );
method.setFollowRedirects(true);
int statusCode = client.executeMethod( method );
if( statusCode != -1 ) {
String contents = method.getResponseBodyAsString();
method.releaseConnection();
System.out.println( contents );
}
Instead of the posted results, I am getting the page containing the form. Should I use
a different url because of the onclick="location.replace('#123')" in the submit
button?
Yahoo! India Matrimony: Find your life partneronline.