JSP Example to create custom tag that will append a String to its own body and will display the result
JSP Example to create custom tag that will append a String to its own body and will display the result Details.java package beginnersbook . com ; import javax . servlet . jsp . tagext .*; import javax . servlet . jsp .*; import java . io .*; public class Details extends SimpleTagSupport { //StringWriter object StringWriter sw = new StringWriter (); public void doTag () throws JspException , IOException { getJspBody (). invoke ( sw ); JspWriter out = getJspContext (). getOut (); out . println ( sw . toString ()+ "Appended Custom Tag Message" ); } } TLD file: message.tld Remember to have this file in WEB-INF folder. <taglib> <tlib-version> 1.0 </tlib-version> <jsp-version> 2.0 </jsp-version> <short-name> My C...