Methods Summary |
---|
public int | doEndTag()
Reader in;
Writer out;
if (reader == null) {
String bcs = getBodyContent().getString().trim();
if (bcs == null || bcs.equals("")) {
throw new JspTagException("In <escapeHtml>, 'reader' " +
"not specified and no non-whitespace content inside the tag.");
}
in = Util.castToReader(bcs);
} else {
in = Util.castToReader(reader);
}
if (writer == null) {
out = pageContext.getOut();
} else {
out = Util.castToWriter(writer);
}
transform(in, out);
return EVAL_PAGE;
|
private void | init()
reader = null;
writer = null;
|
public void | release()Releases any resources we may have (or inherit)
super.release();
init();
|
public void | setReader(java.lang.Object reader)Tag's 'reader' attribute
this.reader = reader;
|
public void | setWriter(java.lang.Object writer)Tag's 'writer' attribute
this.writer = writer;
|
public void | transform(java.io.Reader reader, java.io.Writer writer)Transform
int c;
try {
writer.write("<pre>");
while ((c = reader.read()) != -1) {
if (c == '<") {
writer.write("<");
} else if (c == '>") {
writer.write(">");
} else {
writer.write(c);
}
}
writer.write("</pre>");
} catch (IOException ex) {
throw new JspException("EscapeHtml: " +
"error copying chars", ex);
}
|