hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Glück <ortwin.glu...@nose.ch>
Subject Re: Something is wrong with my hhttpclient
Date Wed, 26 Jan 2005 09:35:41 GMT

barber barber wrote:
> I,m a new user of httpclient. I,m trying to make login to my
> application web by httpclient:

> PostMethod method  = new
> PostMethod("http://dirIp:9080/url/login.jsp");
> method.addParameter("user","xxx"); 
> method.addParameter("password","xxx");

> It works, but when print then body, i get the code of the "login.jsp"
> and i want the code of the reedirected page, which must be the "error
> login page" or the "ini application page". I think it,s not making
> submit.


I guess you are posting to the wrong page. Please look at the HTML code 
of login.jsp. It will have a <form> tag with a action="URI" attribute. 
You need to post to the action URI.

 > And another question if i have more than one form how i especify
 > which one is submitted?

Simple answer: you don't. As HttpClient is not aware of any HTML 
content, you must emulate a specific form by just providing all the form 
fields as parameters and posting it to the right URL.

 > I wait for your answer Thanks very much for your time!! ;)


Ortwin Glück

  NOSE applied intelligence ag

  ortwin glück                      [www]      http://www.nose.ch
  software engineer
  hardturmstrasse 171               [pgp id]           0x81CF3416
  8005 zürich                       [office]      +41-1-277 57 35
  switzerland                       [fax]         +41-1-277 57 12

To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org

View raw message