Source Code Cross Referenced for MessageTag.java in  » EJB-Server-resin-3.1.5 » examples » example » taglib » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server resin 3.1.5 » examples » example.taglib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package example.taglib;
02:
03:        import javax.servlet.jsp.*;
04:        import javax.servlet.jsp.tagext.*;
05:        import java.io.*;
06:
07:        public class MessageTag extends BodyTagSupport {
08:
09:            /* tag attributes fields:
10:             *
11:             * member variables to store the value of tag attributes are treated
12:             * as read-only.  Resin will set the values using setXXXX() based on
13:             * the values passed as attributes to the tag, and the code in the
14:             * class will never change the values.
15:             */
16:            private String _attrTitle;
17:
18:            /* internal tag fields
19:             *
20:             * Since an instance of this class can be reused, initialization of
21:             * internal member variables happens in the init() method, which is
22:             * called from doStartTag()
23:             */
24:            private String _title;
25:            private StringBuffer _msg;
26:
27:            public void setTitle(String title) {
28:                // this is the only place where _attrTitle is ever set
29:                _attrTitle = title;
30:            }
31:
32:            public int doStartTag() throws JspException {
33:                // initialize internal member variables
34:                init();
35:
36:                return EVAL_BODY_BUFFERED;
37:            }
38:
39:            public int doEndTag() throws JspException {
40:                // initialize internal member variables
41:                init();
42:
43:                try {
44:                    // print the message out
45:                    JspWriter out = pageContext.getOut();
46:                    out.println("<p>");
47:                    out.println("<table border=1>");
48:                    out.println("<tr><td>");
49:                    out.println("instance: " + this );
50:                    out.println("<tr><td>");
51:                    out.println(_title);
52:                    out.println("<tr><td>");
53:                    out.println(_msg.toString());
54:                    out.println("</table>");
55:
56:                } catch (Exception ex) {
57:                    throw new JspException(ex);
58:                }
59:
60:                return EVAL_PAGE;
61:            }
62:
63:            /**
64:             * Set defaults for attributes and initialize internal member
65:             * variables.
66:             */
67:            protected void init() {
68:                // default value for _title is "Default Title"
69:                _title = _attrTitle;
70:                if (_title == null)
71:                    _title = "Default Title";
72:
73:                // internal member variables
74:                _msg = new StringBuffer();
75:
76:            }
77:
78:            /** 
79:             * called by nested children to add to the message.  This happens
80:             * after doStartTag() and before doEndTag() 
81:             */
82:            void addToMessage(String text) throws JspException {
83:                _msg.append(text);
84:                _msg.append("<br>");
85:            }
86:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.