Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Tomcat not stable ? -- JSP tag  RSS feed

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I did a small JSP tag. Sometime it works, sometime it doesn't. I don't know why. The problem is located in description file. Thanks
---------- web.xml -------
<web-app>
<taglib>
<taglib-uri>MakerTagXML</taglib-uri>
<!-- sometime works, sometime not work -->
<taglib-location>/MakerTag</taglib-location>
<!-- always work perfectly
<taglib-location>/WEB-INF/MyBodyTag.tld</taglib-location>
-->
</taglib>
</web-app>
-------------- TLD file ---
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>bodytest</short-name>
<uri>/MakerTag</uri>
<tag>
<name>mark</name>
<tag-class>MyBodyTag.MakerTag</tag-class>
<body-content>JSP</body-content>
<description>body tag test</description>
</tag>
</taglib>
------------ JSP file ------
<%@ taglib prefix="test" uri="MakerTagXML"%>
<html>
<body>
<test:mark> this is a test </test:mark>
</body>
</html>
-------- Tag class file ------
public class MakerTag implements BodyTag{
private PageContext pageContext;
private Tag parentTag;
//methods from Tag
public void setPageContext(PageContext pageContext){this.pageContext = pageContext;
}
public void setParent(Tag parentTag){
this.parentTag = parentTag;
}
public Tag getParent(){
return this.parentTag;
}
public int doStartTag()throws JspException{
return BodyTag.EVAL_BODY_BUFFERED;
}
public int doEndTag() throws JspException{
return Tag.EVAL_PAGE;
}
public void release() {
}
// methods from IterationTag
public int doAfterBody()throws JspException{
try{
JspWriter out = bodyContent.getEnclosingWriter();
String text = bodyContent.getString();
out.print(text+" ffff ");
}catch(Exception e){
}
return 1;
}
//methods from BodyTag
private BodyContent bodyContent;
// save the body content in order to access the body content
public void setBodyContent(BodyContent bodyContent){
this.bodyContent = bodyContent;
}
// do some initialization steps on body content
public void doInitBody() throws JspException{
}
}
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65828
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometime it works, sometime it doesn't.

Do you really think that this is enough information about the nature of the error for us to diagnose it for you?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!