• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Posting javascript object using postMethod

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a tons bill specially for introducing me to firebug, that did the trick

Thanks again.
 
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic