tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wyn Easton <>
Subject RE: Integrating servlet output into JSP
Date Sat, 18 Nov 2000 13:10:20 GMT
-- for carnell - I lost the message link

I had a moment to look at the Tomcat source and in
RequestDispatcherImpl saw that the service() method is called
for RequestDispatcher's forward() and include().
JSP's _jspService() is like a regular servlet's service() method.
So, if you want to include an already written Servlet that outputs HTML
in the doGet() method from a JSP you'll have to call the doGet() 
from the Servlet's service() method. 
You could also add a parameter to the path when creating the
RequestDispatcher that would allow you to
call the doGet() when you are including the Servlet from your JSP and
act as it did before if not included from your JSP. 
Like this:

--IN JSP--
RequestDispatcher rd =

--IN aServlet service() method--
String jspIncld = (String)request.getParameter("JspInclude");
if (jspIncld != null)
if ( jspIncld.equals("true"))
... do normal servlet processing ...

Wyn Easton

Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!

View raw message