http://www.java2s.com/Code/Java/JSP/Createyourowntagacustomtagbody.htm
XML 파일 XML의 사용과, 자신의 태그를 만들 수 없습니다 이유 :
<tag>
<description>
Escapes a String to HTML, either writing it to the response
or exporting it to a scoped variable.
The string may be the value attribute or the tag body.
</description>
<name>escapeHTML</name>
<tag-class>nl.strohalm.cyclos.taglibs.EscapeHTMLTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The string value to be escaped. If not set, the tag body will be used instead.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description>If set to true, will only replace line breaks for br tags, ignoring other processing. Defaults to false</description>
<name>brOnly</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
<attribute>
<description>
A context variable name. If provided, instead of writing the escaped value to the response
output, it will be set on the scope determined by the scope attribute, under this variable name
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
The scope name for the variable to be exported.
May be one of: page, request, session or application.
Defaults to page.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
</tag>
그리고 당신이 쓰는 당신이 원하는 것의 작은 자바 코드!
위의 태그에 해당하는 간단한 자바 코드 예 :
public static String escape(final String string, boolean brOnly) {
String out = string;
if (!brOnly) {
out = StringEscapeUtils.escapeHtml(out);
}
out = StringUtils.replace(out, "\n", "<br />");
out = StringUtils.replace(out, "\\n", "<br />");
return out;
}