permaculture playing cards
The moose likes JSP and the fly likes JSP request forwarding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP request forwarding" Watch "JSP request forwarding" New topic

JSP request forwarding

Haritha Gorijavolu

Joined: Feb 18, 2011
Posts: 21

Hi, I am building an application using JSPs. There is a lot of data to be retrived from database and displayed in some JSPs. To make the code more readable and easy to debug, I want to delegate the retrival and display of some information to some code other than the present JSP. Some thing like request forwarding. I don't want to go for request forwarding to another JSP or servlet because the rest of the statements won't execute in the calling page. Even if I use include(request,response), the output is not what I wanted.
I want a mechanism where I can forward some parameters to some code and the code prints response at the palce where it's called in the calling JSP and after printing the response the rest of the calling JSP code continues to execute.
Is it advisable to do the following:
Set the parameters I want to forward as session attributes and use <% include file= %> to do the processing by retriving the session attributes in that file and print response at the place where the file is included.
Please suggest some thing.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

All the up-front work of collecting data should be done in a servlet controller. The data is place in request scope for retrieval and display by the JSP.

Please read this article for more information.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: JSP request forwarding
It's not a secret anymore!