Hello,
I am on NAS 4.0 with JSP 0.92 and am looking for a way to include one
servlet/jsp at the tail end of another servlet/jsp.
These are both NAS extended servlets extending from BaseServlet and both use
default JSP templates.
The first servlet/jsp combination (CallingServlet.java/jsp) will display
some heading information, a choice box and some links.
The second is a data view (a record browser) that allows the user to page
through table display of any recordset and select any value from any cell in
the table.
The second servlet/jsp (RecordBrowser.java/jsp) is a complete servlet/jsp
containing all HTML tags and some Page UP/DOWN buttons.
This record browser can be used in a popup window and now we are trying to
embed the same record browser into a page.
In the first servlet, I CAN do the following:
towards the end of CallingServlet.java in the defaultAction() method, I do
the following:
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("package/RecordBrowser");
aResponse.setContentType("text/html");
dispatcher.include(aRequest, aResponse);
...
//upon success, the BaseServlet will include the default JSP.
return 1;
...which effectively puts the record browser at the beginning of the
resulting page and everything works beautifully.
The problem is, I need the record browser to appear at the end of the
resulting page.
I have tried to do the following to accomplish this:
in CallingServlet.java in the defaultAction() method, I do the following:
...
//ask the BaseServlet to paint the default jsp now.
super.includeDefaultJSP((HttpServletRequest2)aRequest, aResponse);
...
//include our record browser.
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("package/RecordBrowse");
aResponse.setContentType("text/html");
dispatcher.include(aRequest, aResponse);
...
//return a value that will cause BaseServlet not to include the default JSP
a second time.
return -1;
The results are not desirable.
I also tried using similar dispatcher.include() methods in scriptlet tags in
CallingServlet.jsp but the resulting combination page had the HTML, HEAD and
BODY tags all messed up and the page doesn't work correctly.
Does anyone have any ideas that would help me?
Any help is MUCH appreciated!
Thanks a bunch, Vince.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets