• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Parameters in a Servlet

 
sandy gupta
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we set parameters for a HTTPServletRequest Object in a servlet so that the target Servlet can get these using the getParameter(String) method.
Also i need to know if we can change/set the type of method that is used for Submitting the request object(get/post).
Thanks
S
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand your question correctly -
You set parameters in the request by following the HTML /CGI form conventions. Your HTTP request needs to look like it came from a form. The servlet engine automatically extracts them and puts them in the request object.
If you mean setting parameters in a request object that is forwarded to another servlet, you can't, you have to use setAttribute and getAttribute instead.
Bill
 
sandy gupta
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the problem that i am facing is that i need to send multiple requests to a 3rd party system and i do not want to post 600 requests to a form. Is there any way i can bypass that and send those 600 POST requests to the 3rd party system w/o clicking 'Submit' 600 times
I am planning to use 'Synthetic Post' using the URLConnection API and thats the best i sould come up with. I would appreciate if someone could suggest something better than that.
Thanks
S
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a 3rd party system you are going to have to go through a HttpURLConnection, but that should be easy to automate. A HttpServletRequest object only has meaning inside your web applications inside your servlet container.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic