aspose file tools*
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
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP request forwarding" Watch "JSP request forwarding" New topic
Author

JSP request forwarding

Haritha Gorijavolu
Greenhorn

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
Marshal

Joined: Jan 10, 2002
Posts: 61239
    
  66

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] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: JSP request forwarding