Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Static Include JSPs in Servlet

 
Bill Smyth
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35757
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!