{"id":10469,"date":"2015-08-28T09:13:25","date_gmt":"2015-08-28T13:13:25","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/?p=10469"},"modified":"2015-08-24T10:29:07","modified_gmt":"2015-08-24T14:29:07","slug":"filterexample-jsp-page-that-uses-the-filtertag-custom-tag","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=10469","title":{"rendered":"FilterExample.jsp Page that uses the FilterTag custom tag"},"content":{"rendered":"<pre>FilterExample.jsp Page that uses the FilterTag custom tag\r\n\r\n&lt;!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"&gt;\r\n&lt;!-- \r\nIllustration of FilterTag tag. \r\n\r\nTaken from Core Web Programming Java 2 Edition\r\nfrom Prentice Hall and Sun Microsystems Press,\r\n.\r\nMay be freely used or adapted.\r\n--&gt;\r\n&lt;HTML&gt;\r\n&lt;HEAD&gt;\r\n&lt;TITLE&gt;HTML Logical Character Styles&lt;\/TITLE&gt;\r\n&lt;LINK REL=STYLESHEET\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 HREF=\"JSP-Styles.css\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 TYPE=\"text\/css\"&gt;\r\n&lt;\/HEAD&gt;\r\n&lt;BODY&gt;\r\n&lt;H1&gt;HTML Logical Character Styles&lt;\/H1&gt;\r\nPhysical character styles (B, I, etc.) are rendered consistently\r\nin different browsers. Logical character styles, however,\r\nmay be rendered differently by different browsers.\r\nHere's how your browser \r\n(&lt;%= request.getHeader(\"User-Agent\") %&gt;) \r\nrenders the HTML 4.0 logical character styles:\r\n&lt;P&gt;\r\n&lt;%@ taglib uri=\"cwp-taglib.tld\" prefix=\"cwp\" %&gt;\r\n&lt;TABLE BORDER=1 ALIGN=\"CENTER\"&gt;\r\n&lt;TR CLASS=\"COLORED\"&gt;&lt;TH&gt;Example&lt;TH&gt;Result\r\n&lt;TR&gt;\r\n&lt;TD&gt;&lt;PRE&gt;&lt;cwp:filter&gt;\r\n&lt;EM&gt;Some emphasized text.&lt;\/EM&gt;&lt;BR&gt;\r\n&lt;STRONG&gt;Some strongly emphasized text.&lt;\/STRONG&gt;&lt;BR&gt;\r\n&lt;CODE&gt;Some code.&lt;\/CODE&gt;&lt;BR&gt;\r\n&lt;SAMP&gt;Some sample text.&lt;\/SAMP&gt;&lt;BR&gt;\r\n&lt;KBD&gt;Some keyboard text.&lt;\/KBD&gt;&lt;BR&gt;\r\n&lt;DFN&gt;A term being defined.&lt;\/DFN&gt;&lt;BR&gt;\r\n&lt;VAR&gt;A variable.&lt;\/VAR&gt;&lt;BR&gt;\r\n&lt;CITE&gt;A citation or reference.&lt;\/CITE&gt;\r\n&lt;\/cwp:filter&gt;&lt;\/PRE&gt;\r\n&lt;TD&gt;\r\n&lt;EM&gt;Some emphasized text.&lt;\/EM&gt;&lt;BR&gt;\r\n&lt;STRONG&gt;Some strongly emphasized text.&lt;\/STRONG&gt;&lt;BR&gt;\r\n&lt;CODE&gt;Some code.&lt;\/CODE&gt;&lt;BR&gt;\r\n&lt;SAMP&gt;Some sample text.&lt;\/SAMP&gt;&lt;BR&gt;\r\n&lt;KBD&gt;Some keyboard text.&lt;\/KBD&gt;&lt;BR&gt;\r\n&lt;DFN&gt;A term being defined.&lt;\/DFN&gt;&lt;BR&gt;\r\n&lt;VAR&gt;A variable.&lt;\/VAR&gt;&lt;BR&gt;\r\n&lt;CITE&gt;A citation or reference.&lt;\/CITE&gt;\r\n&lt;\/TABLE&gt;\r\n&lt;\/BODY&gt;\r\n&lt;\/HTML&gt;\r\n\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>FilterExample.jsp Page that uses the FilterTag custom tag &lt;!DOCTYPE HTML PUBLIC &#8220;-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN&#8221;&gt; &lt;!&#8211; Illustration of FilterTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. &#8211;&gt; &lt;HTML&gt; &lt;HEAD&gt; &lt;TITLE&gt;HTML Logical Character Styles&lt;\/TITLE&gt; &lt;LINK REL=STYLESHEET \u00a0\u00a0\u00a0\u00a0\u00a0 HREF=&#8221;JSP-Styles.css&#8221; \u00a0\u00a0\u00a0\u00a0\u00a0 TYPE=&#8221;text\/css&#8221;&gt; &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=10469\">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-10469","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":27125,"url":"http:\/\/bangla.sitestree.com\/?p=27125","url_meta":{"origin":10469,"position":0},"title":"FilterExample.jsp Page that uses the FilterTag custom tag #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 11, 2021","format":false,"excerpt":"FilterExample.jsp Page that uses the FilterTag custom tag <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Illustration of FilterTag 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>HTML Logical Character Styles<\/TITLE> <LINK\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":10451,"url":"http:\/\/bangla.sitestree.com\/?p=10451","url_meta":{"origin":10469,"position":1},"title":"SimplePrimeExample.jsp Page that uses the SimplePrimeTag custom tag","author":"","date":"August 28, 2015","format":false,"excerpt":"SimplePrimeExample.jsp Page that uses the SimplePrimeTag 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>Some 50-Digit Primes<\/TITLE> <LINK REL=STYLESHEET\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":10469,"position":2},"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":10476,"url":"http:\/\/bangla.sitestree.com\/?p=10476","url_meta":{"origin":10469,"position":3},"title":"IfExample.jsp Page that uses the custom nested tags","author":"","date":"August 29, 2015","format":false,"excerpt":"IfExample.jsp Page that uses the custom nested tags <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Illustration of IfTag 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>If Tag Example<\/TITLE> <LINK REL=STYLESHEET\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":27109,"url":"http:\/\/bangla.sitestree.com\/?p=27109","url_meta":{"origin":10469,"position":4},"title":"SimplePrimeExample.jsp Page that uses the SimplePrimeTag custom tag #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 11, 2021","format":false,"excerpt":"SimplePrimeExample.jsp Page that uses the SimplePrimeTag 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>Some 50-Digit Primes<\/TITLE> <LINK REL=STYLESHEET\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":10464,"url":"http:\/\/bangla.sitestree.com\/?p=10464","url_meta":{"origin":10469,"position":5},"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":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10469","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=10469"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10469\/revisions"}],"predecessor-version":[{"id":10470,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10469\/revisions\/10470"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10469"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}