I need from one JSP open another JSP, and send POST parameters to this JSP. I need to make same result as response.sendRedirect(url); but using this way I cant use POST request. Also note that I can’t use requestDispatcher because this JSP in another context. I think I need to use something like this:
URL url = new URL("http://www.somesite.com");
URLConnection conn = url.openConnection();
....
writer.write(data);
But I’m not sure that I will open new page.
EDIT: @jaxb, yes, i tried it. But when I use it, I get only new page in existing page (i.e. I change page1 to page2, but not open new one with sending POST data to it).
I guess what you need is a way to construct a valid HTTP Post Request. When I had a similar problem I found a httpclient library shared at http://www.devx.com/Java/Article/17679/1954 to be quite useful and simple to use. It exposes simple methods for setting your post request and then calling a post method to do the actual post. Everything is quite well explained in the article and I would recommend you to give it a try.
At the end of this article the author (Vlad Patryshev) says:
this I feel is quite similar to what you may be looking for.