How can I include these "includes" from a servlet? Cheers
Tony Chen, Gin wrote: > Why dont u just put the includes inside the servlet? > > -----Original Message----- > From: Antony Stace [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 14, 2001 4:35 AM > To: [EMAIL PROTECTED] > Subject: JSP/SERVLET DESIGN QUESTION > > > Hi > > I have a question....I want to know if the following is bad design. > > I have a servlet, called Simple, with the following doPost code in it > > [snip] > public void doPost(HttpServletRequest request, > HttpServletResponse response) > throws ServletException, IOException > { > PrintWriter out = response.getWriter(); > out.println("Simple.doPost() I am a test printing a line from > Simple."); > } > [snip] > > I call this from a jsp file > > ------------------------------ > <HTML> > <HEAD> > <meta http-equiv="Content-Type" content="text/html"> > </HEAD> > > <BODY> > <%@ include file="header.jsp" %> > > <jsp:include page="/servlet/simple" flush="true"> </jsp:include> > > <%@ include file="footer.jsp" %> > </BODY> > </HTML> > ------------------------------ > > Is this a bad design? > > If in the doPost() method in Simple I have a out.close() then the > > [snip] > <%@ include file="footer.jsp" %> > </BODY> > </HTML> > [end of jsp file] > > is not included in the output of the jsp page when it is run. Should > I use a custom taglib instead? > I have a number of pages which I want to have a common header and > footer, but I want the middle part to be constructed by a servlet. Whats > the best way to go about this? > > > Cheers > > Tony > =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
