I have found a problem about servlet when I study the iText with the tutorial.
Environment:
    itext0.96
    windows 2K
    jdk131
    weblogic6.1
    IE5.5 sp2

    Chap0105.java, Compile is OK.

    And I deploy the servlet into Weblogic, it run perfectly.
   
   But I split the Chap0105.java into 2 files,Chap0105.java and PDFPrinter.java,
   PDFWriter.java does the same work as the prvious Chap0105.java.

   After I deployed it into Weblogic and access it, nothing appears in the brows
er and the CUP usage is 100% for a long time. What is the problem?
  
   public class Chap0105 extends HttpServlet {
    
    public void doGet (HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
          PDFPrinter printer = new PDFPrinter();
          printer.print( request, response );
    }
   }

   PDFPrinter.java
      public class PDFPrinter{

      public void print(HttpServletRequest request, HttpServletResponse   
                        response)throws IOException{
      
        String presentationtype = request.getParameter("presentationtype");
        // step 1
        Document document = new Document();
        try {
            if ("pdf".equals(presentationtype)) {
                response.setContentType("application/pdf");
                PdfWriter.getInstance(document, response.getOutputStream());
            }
            else if ("html".equals(presentationtype)) {
                response.setContentType("text/html");
                HtmlWriter.getInstance(document, response.getOutputStream());
            }
            else {
                response.sendRedirect("/error.html")
            }
            
            // step 3
            document.open();
            // step 4
            document.add(new Paragraph(new Date().toString()));
        }
        catch(DocumentException de) {
            de.printStackTrace();
            System.err.println("document: " + de.getMessage());
        }
        document.close();      
      
      }
   
   }

Thank you in advance. Any help is appreciated.

Paula



Do You Yahoo!?
"�Ż����մ�ת�̾�ϲ���� ���ֽ��պ�������!"

Reply via email to