Well, it does declare the correct getter and setter, but on the other hand it also extends HttpServlet. I can't imagine a class being both a bean and a servlet at the same time.
Perhaps just not declaring it to be a servlet would fix the problem. Or maybe there's something else you have to do to declare that it's a bean?
Take that code out of the servlet and get it working in a standalone class.
That would be a lot easier for you to do.
Then, once that's working the way you want you can then have the servlet call that class instead, assuming you've written it in a reasonably accessible way.
You'll be able to do fixes far faster that way...and debugging will be simpler.
That output looks like a PDF to me, sort of. If you want to test that feature then having Adobe Acrobat try to open the output would be the way to go. Although your code suggests that you are expecting HTML. Maybe your Jasper configuration needs to be fixed?
And it looks to me like you're doing a POST request to return that PDF data. And as far as I can see you aren't updating anything on the server from your POST parameters. A GET request would be suitable for that scenario, not a POST.
Paul Clapham wrote:Although your code suggests that you are expecting HTML. Maybe your Jasper configuration needs to be fixed?
No, I see that you're calling a method named exportReportToPdfStream. So you're asking for PDF output. In that case your code which specifies the format of the servlet's response:
isn't right. You ought to be specifying PDF here, not HTML.
It would be fair to say that you don't yet know what a MIME type is, right?
So when I searched the web for that term, the first site I found was MIME types (IANA media types). It would be a good idea for you to read through this document, even though it doesn't answer your immediate question immediately. Sure, you can eventually get working code by asking people on the web to help you, but that doesn't speed up the process of getting working code the next time.
And yes, that site does provide the answer to your question, eventually.
Hi,
after read the articles in MIME types (IANA media types) and
after change my jsp putting the enctype to use the MIME type for PDF the problem still the same.
Your servlet should be saying that it's returning PDF. It used to say, incorrectly, that it was returning HTML. When I suggested you should change that to say it was returning PDF, you just deleted the relevant line of code.
So changing your JSP (which I assume is whatever is requesting that servlet) to incorrectly say that it's sending multipart form-data (which isn't the MIME type for PDF) won't fix the problem you created by changing the servlet.
I can't understand, my original problem was mask to format date of my mysql table "yyyy-mm-dd" to "dd/mm/yyyy". If I return to use the original servlet my report is generated fine without problemas.