Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request needs to be POST In servlet

 
Nalini Nagarathinam
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a requirement that from the jsp, when they click on the link. I will call the servlet, in this i need to add a new parameters with the url and send it as the POST request.

The destination URL is a new domain. Could you please help me on how to send the request as POST method in servlet with the add new parameters.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64701
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a POST the parameters should be passed in the request body, not on the URL. That's how parameters are passed on GETs.

So your requirements are rather screwy.

 
Nalini Nagarathinam
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply..

How to add the parameters in the request body and send it as the POST request?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64701
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To send it to another web application in another domain?

You could either use a tool such as HttpClient to create the request, or you could dynamically create a JSP form and cuase it to be posted with some JavaScript.

The former would be the more elegant and versatile approach.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic