• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Passing parameters to url using java.net package

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have two applications deployed on my server and i need to invoke a register.do class in one application from another application and need to send parameters like username,password,fullname,email,locale,country using post method. I know that using the URL class i can open the connection and open the required url....but how can i pass the parameters to it using post method??? Please advice me.
Thanks
Kranthi
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out example e135 at http://www.exampledepot.com/egs/java.net/pkg.html It shows how to use POST programmatically in Java code, including how to send parameters.
 
kranthi chamarthi
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that link . But still my code is nto working. Following is my code.

I have kept a print statement in multiply_method() of the action class to which arithmeticAction.do points and it is not getting printed.
 
kranthi chamarthi
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I included the code for obtaining the input stream and reading the data from the url and then the program started working. Why is this???Following is the code

This code is working only if the code that is italicized is present.

[ November 10, 2008: Message edited by: kranthi kumar.chamarthi ]
[ November 10, 2008: Message edited by: kranthi kumar.chamarthi ]
 
Bartender
Posts: 9612
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTTP protocol has two parts: a request and a response. If you don't try to read the response, the server may think you've dropped the connection and stop processing the request.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!