Source Code Cross Referenced for JspActionEvent.java in  » Web-Framework » TURBINE » org » apache » turbine » util » jsp » 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 » Web Framework » TURBINE » org.apache.turbine.util.jsp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.turbine.util.jsp;
002:
003:        /*
004:         * Copyright 2001-2004 The Apache Software Foundation.
005:         *
006:         * Licensed under the Apache License, Version 2.0 (the "License")
007:         * you may not use this file except in compliance with the License.
008:         * You may obtain a copy of the License at
009:         *
010:         *     http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS,
014:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License.
017:         */
018:
019:        import java.lang.reflect.Method;
020:        import java.util.Enumeration;
021:        import org.apache.turbine.modules.ActionEvent;
022:        import org.apache.turbine.services.jsp.TurbineJsp;
023:        import org.apache.turbine.util.parser.ParameterParser;
024:        import org.apache.turbine.util.RunData;
025:        import org.apache.velocity.context.Context;
026:
027:        /**
028:         * In order to use Context in Jsp templates your Action's should
029:         * extend this class instead of extending the ActionEvent class.  The
030:         * difference between this class and the ActionEvent class is that
031:         * this class will first attempt to execute one of your doMethod's
032:         * with a constructor like this:
033:         *
034:         * <p>doEvent(RunData data, Context context)
035:         *
036:         * <p>It gets the context from the TemplateInfo.getTemplateContext()
037:         * method. If it can't find a method like that, then it will try to
038:         * execute the method without the Context in it.
039:         *
040:         * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
041:         * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
042:         * @author <a href="mailto:gabrielm@itcsoluciones.com">Gabriel A. Moreno</a>
043:         * @version $Id: JspActionEvent.java 534872 2007-05-03 14:07:18Z tv $
044:         */
045:        public abstract class JspActionEvent extends ActionEvent {
046:            /**
047:             * You need to implement this in your classes that extend this
048:             * class.
049:             *
050:             * @param data A Turbine RunData object.
051:             * @exception Exception, a generic exception.
052:             */
053:            public abstract void doPerform(RunData data) throws Exception;
054:
055:            /**
056:             * This overrides the default Action.perform() to execute the
057:             * doEvent() method.  If that fails, then it will execute the
058:             * doPerform() method instead.
059:             *
060:             * @param data A Turbine RunData object.
061:             * @exception Exception, a generic exception.
062:             */
063:            protected void perform(RunData data) throws Exception {
064:                try {
065:                    executeEvents(data, TurbineJsp.getContext(data));
066:                } catch (NoSuchMethodException e) {
067:                    doPerform(data);
068:                }
069:            }
070:
071:            /**
072:             * This method should be called to execute the event based system.
073:             *
074:             * @param data A Turbine RunData object.
075:             * @param context Jsp context information.
076:             * @exception Exception, a generic exception.
077:             */
078:            public void executeEvents(RunData data, Context context)
079:                    throws Exception {
080:                // Name of the button.
081:                String theButton = null;
082:
083:                // ParameterParser.
084:                ParameterParser pp = data.getParameters();
085:
086:                String button = pp.convert(BUTTON);
087:
088:                // Loop through and find the button.
089:                for (Enumeration e = pp.keys(); e.hasMoreElements();) {
090:                    String key = (String) e.nextElement();
091:                    if (key.startsWith(button)) {
092:                        theButton = formatString(key);
093:                        break;
094:                    }
095:                }
096:
097:                if (theButton == null)
098:                    throw new NoSuchMethodException(
099:                            "ActionEvent: The button was null");
100:
101:                try {
102:                    // The arguments to the method to find.
103:                    Class[] classes = new Class[2];
104:                    classes[0] = RunData.class;
105:                    classes[1] = Context.class;
106:
107:                    // The arguments to pass to the method to execute.
108:                    Object[] args = new Object[2];
109:
110:                    Method method = getClass().getMethod(theButton, classes);
111:                    args[0] = data;
112:                    args[1] = context;
113:                    method.invoke(this , args);
114:                } catch (NoSuchMethodException nsme) {
115:                    // Attempt to execut things the old way..
116:                    super.executeEvents(data);
117:                }
118:            }
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.