{"id":10467,"date":"2015-08-28T00:12:13","date_gmt":"2015-08-28T04:12:13","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/?p=10467"},"modified":"2015-08-24T10:28:48","modified_gmt":"2015-08-24T14:28:48","slug":"filtertag-java-custom-tag-that-modifies-the-tag-body","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=10467","title":{"rendered":"FilterTag.java Custom tag that modifies the tag body"},"content":{"rendered":"<pre>FilterTag.java Custom tag that modifies the tag body\r\n\r\npackage cwp.tags;\r\n\r\nimport javax.servlet.jsp.*;\r\nimport javax.servlet.jsp.tagext.*;\r\nimport java.io.*;\r\nimport cwp.*;\r\n\r\n\/** A tag that replaces &lt;, &gt;, \", and &amp; with their HTML\r\n\u00a0*\u00a0 character entities (&lt;, &gt;, \", and &amp;).\r\n\u00a0*\u00a0 After filtering, arbitrary strings can be placed\r\n\u00a0*\u00a0 in either the page body or in HTML attributes.\r\n\u00a0*\u00a0 &lt;P&gt;\r\n\u00a0*\u00a0 Taken from Core Web Programming Java 2 Edition\r\n\u00a0*\u00a0 from Prentice Hall and Sun Microsystems Press,\r\n\u00a0*\u00a0 .\r\n\u00a0*\u00a0 May be freely used or adapted.\r\n\u00a0*\/\r\n\r\npublic class FilterTag extends BodyTagSupport {\r\n\u00a0 public int doAfterBody() {\r\n\u00a0\u00a0\u00a0 BodyContent body = getBodyContent();\r\n\u00a0\u00a0\u00a0 String filteredBody =\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 ServletUtilities.filter(body.getString());\r\n\u00a0\u00a0\u00a0 try {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 JspWriter out = body.getEnclosingWriter();\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 out.print(filteredBody);\r\n\u00a0\u00a0\u00a0 } catch(IOException ioe) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.println(\"Error in FilterTag: \" + ioe);\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0 \/\/ SKIP_BODY means we're done. If we wanted to evaluate\r\n\u00a0\u00a0\u00a0 \/\/ and handle the body again, we'd return EVAL_BODY_TAG.\r\n\u00a0\u00a0\u00a0 return(SKIP_BODY);\r\n\u00a0 }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>FilterTag.java Custom tag that modifies the tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import cwp.*; \/** A tag that replaces &lt;, &gt;, &#8220;, and &amp; with their HTML \u00a0*\u00a0 character entities (&lt;, &gt;, &#8220;, and &amp;). \u00a0*\u00a0 After filtering, arbitrary strings can be placed \u00a0*\u00a0 in either the page body or in &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=10467\">Continue reading<\/a><\/p>\n","protected":false},"author":130,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1417,1424],"tags":[706,308,285],"class_list":["post-10467","post","type-post","status-publish","format-standard","hentry","category-code-programming-samples--","category-javaj2eej2me","tag-code","tag-java","tag-285","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":27123,"url":"http:\/\/bangla.sitestree.com\/?p=27123","url_meta":{"origin":10467,"position":0},"title":"FilterTag.java Custom tag that modifies the tag body #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 11, 2021","format":false,"excerpt":"FilterTag.java Custom tag that modifies the tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import cwp.*; \/** A tag that replaces <, >, \", and & with their HTML * character entities (<, >, \", and &). * After filtering, arbitrary strings can be placed * in either\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10462,"url":"http:\/\/bangla.sitestree.com\/?p=10462","url_meta":{"origin":10467,"position":1},"title":"DebugTag.java Custom tag that optionally makes use of a tag body","author":"","date":"August 28, 2015","format":false,"excerpt":"DebugTag.java Custom tag that optionally makes use of a tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import javax.servlet.*; \/** A tag that includes the body content only if \u00a0*\u00a0 the \"debug\" request parameter is set. \u00a0*\u00a0 <P> \u00a0*\u00a0 Taken from Core Web Programming Java 2 Edition \u00a0*\u00a0\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10464,"url":"http:\/\/bangla.sitestree.com\/?p=10464","url_meta":{"origin":10467,"position":2},"title":"DebugExample.jsp Page that uses the DebugTag custom tag","author":"","date":"August 28, 2015","format":false,"excerpt":"# DebugExample.jsp Page that uses the DebugTag custom tag <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Illustration of SimplePrimeTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. --> <HTML> <HEAD> <TITLE>Using the Debug Tag<\/TITLE>\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10471,"url":"http:\/\/bangla.sitestree.com\/?p=10471","url_meta":{"origin":10467,"position":3},"title":"RepeatTag.java Custom tag that repeats the tag body a specified number of times","author":"","date":"August 28, 2015","format":false,"excerpt":"RepeatTag.java Custom tag that repeats the tag body a specified number of times package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; \/** A tag that repeats the body the specified \u00a0*\u00a0 number of times. \u00a0*\u00a0 <P> \u00a0*\u00a0 Taken from Core Web Programming Java 2 Edition \u00a0*\u00a0 from Prentice Hall and\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10446,"url":"http:\/\/bangla.sitestree.com\/?p=10446","url_meta":{"origin":10467,"position":4},"title":"SimpleExample.jsp Page that uses the ExampleTag custom tag.","author":"","date":"August 28, 2015","format":false,"excerpt":"SimpleExample.jsp Page that uses the ExampleTag custom tag. <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Illustration of very simple JSP custom tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. --> <HTML> <HEAD> <%@ taglib\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27119,"url":"http:\/\/bangla.sitestree.com\/?p=27119","url_meta":{"origin":10467,"position":5},"title":"DebugTag.java Custom tag that optionally makes use of a tag body #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 11, 2021","format":false,"excerpt":"DebugTag.java Custom tag that optionally makes use of a tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import javax.servlet.*; \/** A tag that includes the body content only if * the \"debug\" request parameter is set. * <P> * Taken from Core Web Programming Java 2 Edition *\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/130"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10467"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10467\/revisions"}],"predecessor-version":[{"id":10468,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10467\/revisions\/10468"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10467"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}