Source Code Cross Referenced for Push.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » components » 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 » J2EE » webwork 2.2.6 » com.opensymphony.webwork.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.opensymphony.webwork.components;
002:
003:        import com.opensymphony.xwork.util.OgnlValueStack;
004:
005:        import java.io.Writer;
006:
007:        /**
008:         * <!-- START SNIPPET: javadoc -->
009:         * <p>Push value on stack for simplified usage.</p>
010:         * <!-- END SNIPPET: javadoc -->
011:         *
012:         * <!-- START SNIPPET: params -->
013:         * <ul>
014:         * 		<li>value* (Object) - value to be pushed into the top of the stack</li>
015:         * </ul>
016:         * <!-- END SNIPPET: params -->
017:         *
018:         *
019:         * <p/> <b>Examples</b>
020:         * <pre>
021:         * <!-- START SNIPPET: example1 -->
022:         * &lt;ww:push value="user"&gt;
023:         *     &lt;ww:propery value="firstName" /&gt;
024:         *     &lt;ww:propery value="lastName" /&gt;
025:         * &lt;/ww:push&gt;
026:         * <!-- END SNIPPET: example1 -->
027:         * </pre>
028:         * 
029:         * <!-- START SNIPPET: example1description -->
030:         * Pushed user into the stack, and hence property tag could access user's properties 
031:         * (firstName, lastName etc) since user is not at the top of the stack
032:         * <!-- END SNIPPET: example1description -->
033:         * 
034:         * <pre>
035:         * <!-- START SNIPPET: example2 -->
036:         *  &lt;ww:push value="myObject"&gt;                              ----- (1)
037:         *       &lt;ww:bean name="jp.SomeBean" id="myBean"/&gt;        ----- (2)
038:         * 		    &lt;ww:param name="myParam" value="top"/&gt;        ----- (3)
039:         *       &lt;/ww:bean&gt;
040:         *   &lt;/ww:push&gt;
041:         * <!-- END SNIPPET: example2 -->
042:         * </pre>
043:         * 
044:         * <pre>
045:         * <!-- START SNIPPET: example2description -->
046:         * when in (1), myObject is at the top of the stack
047:         * when in (2), jp.SomeBean is in the top of stack, also in stack's context with key myBean
048:         * when in (3), top will get the jp.SomeBean instance
049:         * <!-- END SNIPPET: example2description -->
050:         * </pre>
051:         * 
052:         * <pre>
053:         * <!-- START SNIPPET: example3 -->
054:         * &lt;ww:push value="myObject"&gt;                                       ---(A)
055:         *    &lt;ww:bean name="jp.SomeBean" id="myBean"/&gt;                   ---(B)
056:         *       &lt;ww:param name="myParam" value="top.mySomeOtherValue"/&gt;  ---(C)
057:         *    &lt;/ww:bean&gt;
058:         * &lt;/ww:push&gt;
059:         * <!-- END SNIPPET: example3 -->
060:         * </pre>
061:         * 
062:         * <pre>
063:         * <!-- START SNIPPET: example3description -->
064:         * when in (A), myObject is at the top of the stack
065:         * when in (B), jp.SomeBean is at the top of the stack, also in context with key myBean
066:         * when in (C), top refers to jp.SomeBean instance. so top.mySomeOtherValue would invoke SomeBean's mySomeOtherValue() method
067:         * <!-- END SNIPPET: example3description -->
068:         * </pre>
069:         * 
070:         * <pre>
071:         * <!-- START SNIPPET: example4 -->       
072:         * &lt;ww:push value="myObject"&gt;                                 ---- (i)
073:         *    &lt;ww:bean name="jp.SomeBean" id="myBean"/&gt;             ---- (ii)
074:         *       &lt;ww:param name="myParam" value="[1].top"/&gt;         -----(iii)
075:         *    &lt;/ww:bean&gt;
076:         * &lt;/ww:push&gt;
077:         * <!-- END SNIPPET: example4 -->
078:         * </pre>
079:         * 
080:         * <pre>
081:         * <!-- START SNIPPET: example4description -->
082:         * when in (i), myObject is at the top of the stack
083:         * when in (ii), jp.SomeBean is at the top of the stack, followed by myObject
084:         * when in (iii), [1].top will returned top of the cut of stack starting from myObject, namely myObject itself 
085:         * <!-- END SNIPPET: example4description -->
086:         * </pre>
087:         * 
088:         *
089:         * @author Patrick Lightbody
090:         * @author Rene Gielen
091:         * @author tm_jee
092:         * @version $Revision: 2468 $
093:         * @since 2.2
094:         *
095:         * @ww.tag name="push" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.PushTag"
096:         * description="Push value on stack for simplified usage."
097:         */
098:        public class Push extends Component {
099:            protected String value;
100:            protected boolean pushed;
101:
102:            public Push(OgnlValueStack stack) {
103:                super (stack);
104:            }
105:
106:            public boolean start(Writer writer) {
107:                boolean result = super .start(writer);
108:
109:                OgnlValueStack stack = getStack();
110:
111:                if (stack != null) {
112:                    stack
113:                            .push(findValue(value, "value",
114:                                    "You must specify a value to push on the stack. Example: person"));
115:                    pushed = true;
116:                } else {
117:                    pushed = false; // need to ensure push is assigned, otherwise we may have a leftover value
118:                }
119:
120:                return result;
121:            }
122:
123:            public boolean end(Writer writer, String body) {
124:                OgnlValueStack stack = getStack();
125:
126:                if (pushed && (stack != null)) {
127:                    stack.pop();
128:                }
129:
130:                return super .end(writer, body);
131:            }
132:
133:            /**
134:             * Value to push on stack
135:             * @ww.tagattribute required="true"
136:             */
137:            public void setValue(String value) {
138:                this.value = value;
139:            }
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.