Forums Register Login

Exception handling in Servlet

+Pie Number of slices to send: Send
Hello
I have servlet and service method looks like the following:



The problem is in catch block - I'm not able to obtain PrintWriter object -> "OutputStream already obtained"
Any Ideas or suggestions - how to solve this?
+Pie Number of slices to send: Send
Simple. Don't grab it twice. Refactor your code to obtain the output stream once.

P.S. Do you really want to show the stack trace to your users?
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 932 times.
Similar Threads
setting PrintWriter out = response.getWriter(); out.print("My Servlet"); response.setContentType
Web Service
init and destroy method
problem with urldecoder in doGet mehtod
Sharing method between servlets
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:33:00.