浏览 1265 次
锁定老帖子 主题:关于jsp自定义标签问题
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-11-20
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? 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |