hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: Unable to use post with a site
Date Mon, 13 Sep 2004 12:46:05 GMT

first, you should try to add the following:

method.addParameter("abcv", "View")

because a submit button also defines a parameter
when it is given a name.

Due to the onclick handler, there should be a POST
request as well as the modification of the location.
I can't tell whether the location change affects the
current page or the one returned by the POST. It
seems more reasonable if it affects the current
page. Either way, since the new URL starts with a
#, it probably only scrolls the page that is shown to
an anchor within the page. Maybe to move the
submit button out of view, for those impatient users
that would click on it again and again.


Spam Proof <spamproof007@yahoo.co.in> 
13.09.2004 14:13
Please respond to
"Commons HttpClient Project"


Unable to use post with a site

I am using httpclient to post some data to a website.
The actual url that I am trying to post to is 
The asp page corresponding to the form is given below 
<form name="abc" method="post" action="navreport.asp">
     <select size="1" name="cmbmf">
            <option value="all">ALL</option>
            <option value=39>abc</option> 
<input type="submit" value="View" name="abcv" 
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" );


int statusCode = client.executeMethod( method );

if( statusCode != -1 ) {

String contents = method.getResponseBodyAsString();


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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message