2
Hello, I am developing a web application using Servlets and Jsps. I still don’t have much experience with it.
My page contains a button that downloads a BD file and a <object>
HTML to display a PDF that is in the BD.
The button works normally, but the PDF does not appear. It is not appearing because step as parameter the id
with request.getParameter("id")
, but the problem is that it is not enough to make a request for this my Servlet.
To illustrate, my select this way:
SELECT pdf from pdf WHERE id = ?
When I give a request.getParameter("id")
and step the id
as a parameter in this query doesn’t quite work, but if I change the query already passing a parameter as:
SELECT pdf from pdf WHERE id = 1
Then the PDF click on the page.
In short: I have a JSP, which contains only one button that makes one request for a Servlet to download a BD file. Works perfectly and I have a <object>
to display a PDF that is also stored in the BD, but this does not work as I explained.
What I think might be happening is that the button works because when I give submit
he does the request to Servlet, but the PDF is already to be loaded on the screen when the page opens and I do not have much experience with programming Java for the WEB, I am not able to make a request to the Servlet when the page loads.
Can someone help me with this? I need some Javascript or similar function to request and pass the parameter to my PDF Servlet?
I did as you said, but I haven’t gotten any results yet
– henrique romao
Can you post an example of what the Servlet code should look like for the answer? No Headers? -
– henrique romao
I did. Actually a little different, but it helped me a lot your reply! Thank you very much!!
– henrique romao
@I’m glad you made it. I’m sorry I didn’t return before, but I’m in another zone. Hug.
– utluiz
If you could post your answer would be good, I’m with the same diffusion
– R.Santos