Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Static Include JSPs in Servlet

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm adding a bit of functionality to an existing, large web application. The functionality doesn't generate any HTML. Essentially it just makes calls to a bunch of libraries to generate a pdf document. I'm new to j2ee but this seems liike a job for a servlet rather than a jsp. The problem is that the web application is almost 100% jsp based. As such there are three or four jsps which set up and initialize a bunch of necessary hooks into the server environment. So, one of the jsps might look like this:

<%@ include file="../setup/setup2.jspf"%>
<%@ include file="../setup/setup2.jspf"%>
<%@ include file="../setup/setup2.jspf"%>
<%@ include file="../setup/setup2.jspf"%>

<%
Object myObject = ObjectManager.getObject("someString");
%>

where the ObjectManager instance is set up in one of the statically included jsps. I looked into trying to replicate the setup code in my servlet, but it's too complicated to be practical. So, the path of least resistence is just to create a jsp, include the setup files and then just do everything in one big scriptlet. If I really wanted to go with a servlet instead, is there some way to manage this? I know that I can't actually static include a jsp into a servlet, but what if I created a jsp for just the purpose of statically including the file and then forwarded the request to a Servlet? That wouldn't work right? Does anyone have any other suggestions?

Thanks.
 
author & internet detective
Posts: 40747
827
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill,
What do you want the page to be? The standard header/footer with a pdf embedded in the middle? If so, you can use a JSP to do the includes and have an iframe in the middle referencing the servlet that generates the PDF.

A PDF has to be a separate document anyway. You can't have an HTML header on it.
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic