Hi,
I have implemented a number tag that simply reads the body content and
print it using the JspWriter:
public class NumberTag extends Tag {
public NumberTag(String prefix, String tagname) {
super(prefix, tagname);
}
public int doStartTag() {
return EVAL_BODY;
}
public int doEndTag() throws JspError {
JspWriter out = getPreviousOut();
try {
out.println(getBodyOut().getString());
} catch (IOException e) {
}
return EVAL_PAGE;
}
}
When it is used in the following .jsp file the body content is written
twice, i.e. getBodyOut().getString() returns "1234512345":
<%@ page session="false" %>
<%@ taglib uri="mytags.jar" prefix="test" %>
<html>
<body>
<test:number decimals=2>12345</test:number>
</html>
Output:
1234512345
Any idea why ?
/Morten