hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Facing problems to send viewstate value through post method
Date Fri, 28 Nov 2008 15:34:43 GMT
Regardless of how JSF works internally, a browser only communicates
with a server using HTTP.

What you need to do is to ensure that the HttpClient code sends the
same (or sufficiently similar) requests as a browser would do.

In the case of form fields, when a user presses the send button, the
browser gathers up all the fields, which may be user specified or
hidden, and packages them as parameters of the HTTP request. Your code
needs to do the same.

See:

http://hc.apache.org/httpcomponents-client/primer.html

On 28/11/2008, sivasaibabu.parupalli@bt.com
<sivasaibabu.parupalli@bt.com> wrote:
> Hi Chris,
>  Thank you very much for that information.
>  Here I need bit more clarification.
>  If we parse the content resulting from GET Request and send it back will
>  it be surely the same value? why because I was under the impression that
>  it gets changed dynamically every time.
>  And please also tell me what is viewstate will it be any string value or
>  any certificate. I do not know any thing about JSF
>
>
>
>  Thanks and Regards,
>  Sai,
>  pp3.2.46, BT Ipswich ISU, Bibb Way, Ipswich,
>  Suffolk, IP1 2EQ,UK
>  +44 1473 348748
>
>
>
> -----Original Message-----
>  From: Chris Lowe [mailto:chris.lowe.uk@gmail.com]
>  Sent: 28 November 2008 13:34
>  To: HttpClient User Discussion
>  Subject: Re: Facing problems to send viewstate value through post method
>
>  Sai,
>
>  It's not advisable to just copy the view state from your form - it will
>  break the second you change your page structure.  Also, recent JSF 1.2
>  implementations can be configured to expire view state as a security
>  measure.
>
>  Usually I do a GET request to the form URL first, parse the resulting
>  content (a simple regex will suffice) in order to get viewstate value
>  and then post back the form data with the view state.
>
>  I hope that helps,
>
>  Chris.
>
>
>  2008/11/28 <sivasaibabu.parupalli@bt.com>
>
>  >
>  > Hi,
>  > I am trying to post data to one page through post method It is working
>
>  > fine from IE When I am trying to get the page from my java program by
>  > sending input data the same page is coming but I am not getting the
>  > results page based on the input.
>  >
>  > When I examined the page there is one hiddenvalue '_viewstate' as that
>
>  > page is developed by using JSF From the result page I am extracting
>  > the viewstate value and when post all the input including viewstate I
>  > am getting  HTTP/1.1 405 Method Not Allowed
>  >
>  > Please guide me how to procede
>  >
>  >
>  >
>  >
>  >
>  >
>  > Thanks and Regards,
>  > Sai,
>  > pp3.2.46, BT Ipswich ISU, Bibb Way, Ipswich, Suffolk, IP1 2EQ,UK
>  > +44 1473 348748
>  >
>  >
>  >
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>  For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

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


Mime
View raw message