Q:

jsp - Send a request to a Servlet, receive the response and open URL

I've been trying to solve this in many ways, and I've found this is the best approach i can get.
There is an existing web application, with several jsp's. Some of them include a button which at the moment calls for an Applet, going to be replaced. This jsp should send a base64-encoded XML file consisting of different parameters, captured both from the webpage AND from a properties file in a server.
I've thought of the following steps:

First of all, the jsp sends a request to a servlet with the required user-introduced parameters.
Second step: the servlet receives the information sent by the jsp and gets the extra information required from the properties file (which is obviously in the server side).
The servlet creates the required XML file and encodes it in B64.
Proceeds to send it back to the user's browser.
Finally, the jsp should open a URL with the B64-encoded XML as a parameter.

The thing is: Is it possible for the jsp to send a request, receive a response, and finally, with that response, open a URL?
Thanks in advance!

A:

I've been trying to solve this in many ways

Did you try with Ajax ? or Form Submit in JSP ?

The thing is: Is it possible for the jsp to send a request, receive a response, and finally, with that response, open a URL?

You can do that with Ajax call .
1.Have Jquery included in your jsp.
2.On click of button send ajax request to servlet
3.check the response on ajax success callback and open URL

