Pregunta

i am using GWT

I trying to dowload a file using Servlet.

I have fileId on the client side.

i have my servlet ready to look for the file using fileId and send back to client.

But on the Client side. I dont understand how to send this id and retrieve this on server side to use it.

String fileId = "aValidId"
Window.open(GWT.getHostPageBaseURL() + "DownloadFileServlet", "", "");

Can any one help me to do this.

If this question is repeated , please send me a link (i could not find it )

Thanks in advance

¿Fue útil?

Solución

You can simply append the parameter to the servlet path like below

String fileId = "aValidId"
Window.open(GWT.getHostPageBaseURL() +
                          "DownloadFileServlet?fileId ="+fileId , "", "");

And in servlet get the parameter like below:

String myParam = req.getParameter("myparam");

And please go through the below link for encoding and for other techniques..

http://perishablepress.com/how-to-write-valid-url-query-string-parameters/

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top