tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46249] New: "stream closed" problem
Date Thu, 20 Nov 2008 10:38:34 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=46249

           Summary: "stream closed" problem
           Product: Tomcat 5
           Version: 5.5.27
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: huangfeng@tongtech.com


Tag handler Class:

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;

public class sayHello extends BodyTagSupport{

        private String name = null;
        private String value = null;
        private JspWriter out = null;
        public void setName(String name){
                this.name = name;
        }
    public int doStartTag(){

                        try {
                                getOut();
                        //      out.close();
                                value += "v";
                                out.println("hello:" + getName());
                                out.println("dddd:" + getValue());
                        } catch (IOException e) {
                                e.printStackTrace();
                        }               
                return 0;
    }

    public int doEndTag(){
        try{
                getOut();
                out.print("<br>");
        }catch(IOException e){
                e.printStackTrace();
                return 1;
        }
        return 0;
    }

    public JspWriter getOut() {
        if (out == null) {
                System.out.println("get out..................");
            out = pageContext.getOut();
        }
        return out;
    }
        public String getValue() {
                return value;
        }
        public void setValue(String value) {
                this.value = value;
        }
        public String getName() {
                return name;
        }
}

a jsp:

<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/mytld.tld" prefix="aa" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
  <head>


  </head>

  <body>

   <aa:sayHello name="aaaaaaaaaaaaaaa"
value="/web/bsloginAction.do?method=setArea&id="></aa:sayHello>
  </body>
</html>


access this jsp page ,might be thrown "Stream closed" Excepetion.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message