• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Tomcat not stable ? -- JSP tag

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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{
}
}
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
I was her plaything! And so was this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic