{"id":27117,"date":"2021-05-11T23:10:05","date_gmt":"2021-05-12T03:10:05","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/headingexample-jsp-page-that-uses-the-headingtag-custom-tag-programming-code-examples-java-j2ee-j2me-applets-and-basic-graphics\/"},"modified":"2021-05-11T23:10:05","modified_gmt":"2021-05-12T03:10:05","slug":"headingexample-jsp-page-that-uses-the-headingtag-custom-tag-programming-code-examples-java-j2ee-j2me-applets-and-basic-graphics","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=27117","title":{"rendered":"HeadingExample.jsp Page that uses the HeadingTag custom tag #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics"},"content":{"rendered":"<pre>\nHeadingExample.jsp Page that uses the HeadingTag custom tag\n\n\n&lt;!DOCTYPE HTML PUBLIC &quot;-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN&quot;&gt;\n&lt;!-- \nIllustration of HeadingTag tag. \n\nTaken from Core Web Programming Java 2 Edition\nfrom Prentice Hall and Sun Microsystems Press,\n.\nMay be freely used or adapted. \n--&gt;\n&lt;HTML&gt;\n&lt;HEAD&gt;\n&lt;TITLE&gt;Some Tag-Generated Headings&lt;\/TITLE&gt;\n&lt;\/HEAD&gt;\n&lt;BODY&gt;\n&lt;%@ taglib uri=&quot;cwp-taglib.tld&quot; prefix=&quot;cwp&quot; %&gt;\n&lt;cwp:heading bgColor=&quot;#C0C0C0&quot;&gt;\nDefault Heading\n&lt;\/cwp:heading&gt;\n&lt;P&gt;\n&lt;cwp:heading bgColor=&quot;BLACK&quot; color=&quot;WHITE&quot;&gt;\nWhite on Black Heading\n&lt;\/cwp:heading&gt;\n&lt;P&gt;\n&lt;cwp:heading bgColor=&quot;#EF8429&quot; fontSize=&quot;60&quot; border=&quot;5&quot;&gt;\nLarge Bordered Heading\n&lt;\/cwp:heading&gt;\n&lt;P&gt;\n&lt;cwp:heading bgColor=&quot;CYAN&quot; width=&quot;100%&quot;&gt;\nHeading with Full-Width Background\n&lt;\/cwp:heading&gt;\n&lt;P&gt;\n&lt;cwp:heading bgColor=&quot;CYAN&quot; fontSize=&quot;60&quot;\n                fontList=&quot;Brush Script MT, Times, serif&quot;&gt;\nHeading with Non-Standard Font\n&lt;\/cwp:heading&gt;\n&lt;\/BODY&gt;\n&lt;\/HTML&gt;\n\npackage cwp.tags;\n\nimport javax.servlet.jsp.*;\nimport javax.servlet.jsp.tagext.*;\nimport java.io.*;\n\n\/** Generates an HTML heading with the specified background\n *  color, foreground color, alignment, font, and font size.\n *  You can also turn on a border around it, which normally\n *  just barely encloses the heading, but which can also\n *  stretch wider. All attributes except the background\n *  color are optional.\n *  &lt;P&gt;\n *  Taken from Core Web Programming Java 2 Edition\n *  from Prentice Hall and Sun Microsystems Press,\n *  .\n *  May be freely used or adapted.\n *\/\n\npublic class HeadingTag extends TagSupport {\n  private String bgColor; \/\/ The one required attribute\n  private String color = null;\n  private String align=&quot;CENTER&quot;;\n  private String fontSize=&quot;36&quot;;\n  private String fontList=&quot;Arial, Helvetica, sans-serif&quot;;\n  private String border=&quot;0&quot;;\n  private String width=null;\n\n  public void setBgColor(String bgColor) {\n    this.bgColor = bgColor;\n  }\n\n  public void setColor(String color) {\n    this.color = color;\n  }\n\n  public void setAlign(String align) {\n    this.align = align;\n  }\n\n  public void setFontSize(String fontSize) {\n    this.fontSize = fontSize;\n  }\n\n  public void setFontList(String fontList) {\n    this.fontList = fontList;\n  }\n\n  public void setBorder(String border) {\n    this.border = border;\n  }\n\n  public void setWidth(String width) {\n    this.width = width;\n  }\n\n  public int doStartTag() {\n    try {\n      JspWriter out = pageContext.getOut();\n      out.print(&quot;&lt;TABLE BORDER=&quot; + border +\n                &quot; BGCOLOR=&quot;&quot; + bgColor + &quot;&quot;&quot; +\n                &quot; ALIGN=&quot;&quot; + align + &quot;&quot;&quot;);\n      if (width != null) {\n        out.print(&quot; WIDTH=&quot;&quot; + width + &quot;&quot;&quot;);\n      }\n      out.print(&quot;&gt;&lt;TR&gt;&lt;TH&gt;&quot;);\n      out.print(&quot;&lt;SPAN STYLE=&quot;&quot; +\n                &quot;font-size: &quot; + fontSize + &quot;px; &quot; +\n                &quot;font-family: &quot; + fontList + &quot;; &quot;);\n      if (color != null) {\n        out.println(&quot;color: &quot; + color + &quot;;&quot;);\n      }\n      out.print(&quot;&quot;&gt; &quot;); \/\/ End of &lt;SPAN ...&gt;\n    } catch(IOException ioe) {\n      System.out.println(&quot;Error in HeadingTag: &quot; + ioe);\n    }\n    return(EVAL_BODY_INCLUDE); \/\/ Include tag body\n  }\n\n  public int doEndTag() {\n    try {\n      JspWriter out = pageContext.getOut();\n      out.print(&quot;&lt;\/SPAN&gt;&lt;\/TABLE&gt;&quot;);\n    } catch(IOException ioe) {\n      System.out.println(&quot;Error in HeadingTag: &quot; + ioe);\n    }\n    return(EVAL_PAGE); \/\/ Continue with rest of JSP page\n  }\n}\n\n\n<\/pre>\n<p>Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10280<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, Applets and Basic Graphics<br \/>Tags:Java\/J2EE\/J2MEApplets and Basic Graphics<br \/> Post Data:2017-01-02 16:04:31<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>HeadingExample.jsp Page that uses the HeadingTag custom tag &lt;!DOCTYPE HTML PUBLIC &quot;-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN&quot;&gt; &lt;!&#8211; Illustration of HeadingTag 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;Some Tag-Generated Headings&lt;\/TITLE&gt; &lt;\/HEAD&gt; &lt;BODY&gt; &lt;%@ taglib uri=&quot;cwp-taglib.tld&quot; prefix=&quot;cwp&quot; %&gt; &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=27117\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-27117","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":10460,"url":"http:\/\/bangla.sitestree.com\/?p=10460","url_meta":{"origin":27117,"position":0},"title":"HeadingExample.jsp Page that uses the HeadingTag custom tag","author":"","date":"August 28, 2015","format":false,"excerpt":"HeadingExample.jsp Page that uses the HeadingTag custom tag <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Illustration of HeadingTag 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 Tag-Generated Headings<\/TITLE> <\/HEAD> <BODY>\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":10444,"url":"http:\/\/bangla.sitestree.com\/?p=10444","url_meta":{"origin":27117,"position":1},"title":"cwp-taglib.tld Tag Library Descriptor file used by the custom tags in this chapter.","author":"","date":"August 28, 2015","format":false,"excerpt":"cwp-taglib.tld Tag Library Descriptor file used by the custom tags in this chapter. <?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> <!DOCTYPE taglib \u00a0PUBLIC \"-\/\/Sun Microsystems, Inc.\/\/DTD JSP Tag Library 1.1\/\/EN\" \u00a0\"http:\/\/java.sun.com\/j2ee\/dtds\/web-jsptaglibrary_1_1.dtd\"> <!-- a tag library descriptor --> <taglib> \u00a0 <!-- after this the default space is \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"http:\/\/java.sun.com\/j2ee\/dtds\/jsptaglibrary_1_2.dtd\" \u00a0\u00a0 --> \u00a0 <tlibversion>1.0<\/tlibversion> \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":27092,"url":"http:\/\/bangla.sitestree.com\/?p=27092","url_meta":{"origin":27117,"position":2},"title":"cwp-taglib.tld Tag Library Descriptor file used by the custom tags in this chapter. #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 10, 2021","format":false,"excerpt":"cwp-taglib.tld Tag Library Descriptor file used by the custom tags in this chapter. <?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> <!DOCTYPE taglib PUBLIC \"-\/\/Sun Microsystems, Inc.\/\/DTD JSP Tag Library 1.1\/\/EN\" \"http:\/\/java.sun.com\/j2ee\/dtds\/web-jsptaglibrary_1_1.dtd\"> <!-- a tag library descriptor --> <taglib> <!-- after this the default space is \"http:\/\/java.sun.com\/j2ee\/dtds\/jsptaglibrary_1_2.dtd\" --> <tlibversion>1.0<\/tlibversion> <jspversion>1.1<\/jspversion> <shortname>cwp<\/shortname> <!-- ** CHANGED\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":27117,"position":3},"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":10154,"url":"http:\/\/bangla.sitestree.com\/?p=10154","url_meta":{"origin":27117,"position":4},"title":"HelloWWW.java Servlet that generates HTML. This and all remaining servlets are in the cwp package and therefore should be installed in the cwp subdirectory.","author":"","date":"August 14, 2015","format":false,"excerpt":"HelloWWW.java\u00a0 Servlet that generates HTML. This and all remaining servlets are in the cwp package and therefore should be installed in the cwp subdirectory. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; \/** Simple servlet that generates HTML. \u00a0* \u00a0 \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":26519,"url":"http:\/\/bangla.sitestree.com\/?p=26519","url_meta":{"origin":27117,"position":5},"title":"HelloWWW.java  Servlet that generates HTML. This and all remaining servlets are in the cwp package and therefore should be installed in the cwp subdirectory. #Programming Code Examples #Java\/J2EE\/J2ME #Servlet","author":"Author-Check- Article-or-Video","date":"April 27, 2021","format":false,"excerpt":"HelloWWW.java Servlet that generates HTML. This and all remaining servlets are in the cwp package and therefore should be installed in the cwp subdirectory. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; \/** Simple servlet that generates HTML. * * Taken from Core Web Programming Java 2 Edition * from\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\/27117","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\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27117"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/27117\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27117"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}