File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP /Servlet - Printing issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP /Servlet - Printing issue" Watch "JSP /Servlet - Printing issue" New topic

JSP /Servlet - Printing issue

Saket Barve
Ranch Hand

Joined: Dec 19, 2002
Posts: 229
Hi all,
I have a JSP page which is using a Bean. The Bean performs all the actions i.e. fetching data, storing it and displaying the same using System.out.println
Now, the same data needs to be displayed on the browser. With Servlets, I'd use something like:

How can I access HttpServletResponse parameter in a JSP page, so that the same can be sent to the Bean in order to display the contents?
If there is any other way to do this, please let me know.
Bhushan Jawle
Ranch Hand

Joined: Nov 22, 2001
Posts: 249
For printing in JSP you can use the implicit variable "out" to do the printing which is of type javax.servlet.jsp.JspWriter
matt hooker
Ranch Hand

Joined: Jul 26, 2001
Posts: 46
Why not make use of the jsp:useBean functionality and access the data from the bean directly. Alternatively, create some sort of data object to hold the data you wish to display and then set it / get it from the session.

Its not what you do, its the way you say you've done it.
suresh guru
Ranch Hand

Joined: Sep 07, 2002
Posts: 38
In the servlet use getServletConfig().getServletContext().getRequestDispatcher("jsp-page").forward(req,res)
by this u r passing the request & response present in this servlet to the jsp page
hope this helps
I agree. Here's the link:
subject: JSP /Servlet - Printing issue
It's not a secret anymore!