关于jsp自定义标签问题
以下是标签处理类
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;
}
}
一下是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>
其他配置不用赘叙
在用LR压此jsp,马上抛"stream close"异常,tomcat是这样,weblogic却一点错都没有,难道是tomcat bug?