my dog learned polymorphism*
The moose likes Servlets and the fly likes Setting Parameters in a Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Setting Parameters in a Servlet" Watch "Setting Parameters in a Servlet" New topic
Author

Setting Parameters in a Servlet

sandy gupta
Ranch Hand

Joined: Jan 30, 2001
Posts: 228
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


Adios
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
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

Joined: Jan 30, 2001
Posts: 228
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

Joined: Mar 22, 2000
Posts: 12791
    
    5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting Parameters in a Servlet