问题严重啊!!!tomcat下正常,Weblogic下产生错误---->>>>关于Iteration Tag的!!

coolbat 2001-08-21 11:41:25
问题1. weblogic6下在doStartTag()方法中return 的值不论为咋,doEndTag()均不会被call到,why????????????即结果为
Now time is Tue Aug 21 11:22:11 CST 2001________


在tomcat下却运行良好,即结果为
Now time is Tue Aug 21 11:22:11 CST 2001________
aaaa0
aaaa1
aaaa2
aaaa3
aaaa4
aaaa5
aaaa6
aaaa7
aaaa8
aaaa9
aaaa




问题2.weblogic6下在doStartTag()方法中return 的值不能为EVAL_BODY_INCLUDE, 而在tomcat下却可以,why?????????????
错误为运行期产生,LOG如下:
####<2001-8-21 上午11时20分34秒> <Error> <HTTP> <wujq> <myserver> <ExecuteThread: '14' for queue: 'default'> <> <> <101017> <[WebAppServletContext(2310757,DefaultWebApp_myserver)] Root cause of ServletException>
javax.servlet.jsp.JspTagException: Since tag class mytag.ShowtimeTag2 implements BodyTag, it cannot return Tag.EVAL_BODY_INCLUDE
at jsp_servlet._testtag2._jspService(_testtag2.java:106)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

















//////下面是TAG实现文件ShowtimeTag.java
package mytag;
import java.io.*;
import java.util.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class ShowtimeTag extends BodyTagSupport {
int iii=0;
public int doStartTag() throws JspException {
StringBuffer html = new StringBuffer();
java.util.Date nowdate=new java.util.Date();
String dateStr=nowdate.toString();
dateStr+="________<br>";
html.append(dateStr);
try {
pageContext.getOut().write(html.toString());
} catch (IOException ioe) {
throw new JspException(ioe.getMessage());
}
return EVAL_BODY_TAG;//SKIP_BODY;//EVAL_BODY_INCLUDE;这题就在这里!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}

public int doAfterBody() throws JspException {
StringBuffer html = new StringBuffer();
String dateStr = "";
dateStr+=iii;
dateStr+="<br>";
html.append(dateStr);
if (iii++<10) {
try {
pageContext.getOut().write(html.toString());
}
catch (IOException ioe) {
throw new JspException(ioe.getMessage());
}
return EVAL_BODY_TAG;
}
else {
return SKIP_BODY;
}
}
}


//////////这里是taglib.tld啦
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">

<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>examples</shortname>
<uri>http://127.0.0.1:7001/taglib</uri>
<info>An example tag library</info>

<tag>
<name>showtime</name>
<tagclass>mytag.ShowtimeTag2</tagclass>
<info>Works out how large a file, pointed to by a URI, is in bytes</info>
</tag>


</taglib>




////////////这就是调用文件
<html>
<head>
<%@ taglib uri="http://127.0.0.1:7001/taglib" prefix="examples" %>
</head>
<body>
Now time is

<examples:showtime>
aaaa
</examples:showtime>
<br>
</body>
</html>


...全文
35 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
kobe_lee 2001-08-21
原来经常碰taglib到tomcat正常,j2ee下出错的事情!重写就不明补白的好了!
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2001-08-21 11:41
社区公告
暂无公告