Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Posting javascript object using postMethod  RSS feed

 
Nabeel Shaheen
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,

I want to submit this form using Java but I believe there is a client side javascript variable that is being to send

to server for validation that a certain action happened within browser

The API I am using is org.apache.commons.httpclient.*

Following is the form I am trying to post to.



and following is the client side validation using javascript to confirm that the form is manipulated in browser.



As it is apparent from the javascript that iws.className is changed to 'buttonChanged' upon certain event and I am
assuming that this is validated on the server side before the form is processed.

My question is how can I pass this information to the server using org.apache.commons.httpclient.*?

Your kind comments are extremely welcome.

Regards,
NS
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is how can I pass this information to the server using org.apache.commons.httpclient.*?


It is not clear to me why you think HttpClient has to be involved.

HttpClient is used to emulate browsers but you already have a browser so the problem is making JavaScript do what you want.

Bill
 
Nabeel Shaheen
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think i need to make my question clear here further.

Actually I am trying to post the form i mentioned above using java not browser, but i think there is some server validation due to which my form submission is not producing desired result. (yes you are smelling right)

on investigation i noticed that particular javascript is manipulating one of form fields(iws) as shown above so i think there is some relation with this form field and server validation and hence want to know if i can pass this javascript object from httpclient api to server.

any advice is more than welcome.

cheers
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A browser is NOT going to "post a javascript object" in a form. POSTing a Form sends a request with the body containing name and value pairs in plain text whether they come from Javascript or not.

If this was my problem I would use a FireFox plugin like Firebug to capture exactly what the Form post contains. Then you can use HTTPClient to emulate that. Firebug is also great for seeing exactly what Javascript is doing.

The other FireFox plugin I use all the time is Live HTTP Headers.

Bill
 
Nabeel Shaheen
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a tons bill specially for introducing me to firebug, that did the trick

Thanks again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!