почему бы не создать свои собственные теги с использованием XML
http://www.java2s.com/Code/Java/JSP/Createyourowntagacustomtagbody.htm
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>
И затем вы пишете небольшой код Javaтого, чего вы хотите достичь!
например, соответствующий тегу выше простой пример кода Java:
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;
}