• 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

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: 41860
908
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic