• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP request forwarding

 
Greenhorn
Posts: 21
Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic