Thanks for the reply Amrinder.

This was just a little test program.  The code which I want for the real
version is quite long and complicated so it can't go into the JSP page.
  Any ideas on what I should do?

CHeers

Tony


Amrinder, Arora (Meritage) wrote:

> Antony,
>
> why dont you put the code from doPost in Simple as a code snippet in the JSP
> page?  Primarily that is the purpose of code snippets.  If there is any
> common functionality that you want in 10 JSPs, you can put them in a
> package, and use that package in your 10 java snippets within each JSP page.
>
> --amrinder
>
> -----Original Message-----
> From: Antony Stace [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 14, 2001 4:23 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?

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to