This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a JSP page called prgfile, from which I call a servlet. I tried to call getOutputStream() of the ServletResponse in the servlet but got an error which said getOutputStream() is already opened. But i didnt open this any where before that servlet call. In the prgfile_jsp servlet, I found pageContext.getOut(). does this statement preventing me from calling the getOutputStream? but all the JSPs shud have this getOut() called. so, how is it possible to call a o/p stream in another servlet? can a outputstream object be sent as a parameter to the servlet so that in the servlet it can write to the browser either character data or image bytes. Thanks, Padma.
The JSP has already opened the output stream as a JspWriter so you can't open it again as an OutputStream. The usual approach is to have a servlet get the initial request and dispatch to JSP because you have more control in a servlet. Bill