Source Code Cross Referenced for BindingUpdateErrors.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » tags » html » 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 » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.tags.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         *
017:         * $Header:$
018:         */
019:        package org.apache.beehive.netui.tags.html;
020:
021:        import org.apache.beehive.netui.pageflow.ServletContainerAdapter;
022:        import org.apache.beehive.netui.pageflow.internal.AdapterManager;
023:        import org.apache.beehive.netui.pageflow.internal.BindingUpdateError;
024:        import org.apache.beehive.netui.pageflow.internal.InternalUtils;
025:        import org.apache.beehive.netui.tags.AbstractSimpleTag;
026:        import org.apache.beehive.netui.util.Bundle;
027:
028:        import javax.servlet.ServletRequest;
029:        import javax.servlet.jsp.JspException;
030:        import javax.servlet.jsp.PageContext;
031:        import java.util.Iterator;
032:        import java.util.LinkedHashMap;
033:
034:        /**
035:         * Renders the set of error messages found during processPopulate when the
036:         * values to be updated cannot be resolved.  These errors are treated as
037:         * warnings.  By default, this tag is only on in Iterative Dev mode and
038:         * the warning are not displayed in production mode.  The tag is intended
039:         * for development use.
040:         * @jsptagref.tagdescription
041:         * Renders the set of error messages found during the process of resolving
042:         * data binding expressions (pageFlow.firstname, requestScope.firstname, etc.).
043:         * The tag is intended for development use and not for error reporting in deployed applications.  When the
044:         * NetUI framework is not in development mode, this tag will do nothing.
045:         *
046:         * @example
047:         * <p>
048:         * In this first sample, because the &lt;netui:bindingUpdateErrors/> tag is unqualified,
049:         * messages will be displayed if <b>any</b> data binding errors occurred when a form was
050:         * posted. The messages are displayed on the page and the command window.
051:         * </p>
052:         * <pre>&lt;netui:bindingUpdateErrors /></pre>
053:         * <p>
054:         * In this next sample, only binding errors for the expression <code>{actionForm.firstName}</code>
055:         * will be displayed on the page and the command window.
056:         * </p>
057:         * <pre>&lt;netui:bindingUpdateErrors expression="actionForm.firstName"/></pre>
058:         * <p>
059:         * Note, the expression used in this tag needs to match the expressions used to POST form data.  This
060:         * tag's <code>expression</code> attribute must resolve to a valid NetUI expression.
061:         * </p>
062:         * @netui:tag name="bindingUpdateErrors" body-content="empty"
063:         *            description="Will display a message for all binding update errors that occurred when a form was posted."
064:         */
065:        public class BindingUpdateErrors extends AbstractSimpleTag {
066:            private String _expression = null;
067:            private boolean _alwaysReport = false;
068:
069:            /**
070:             * Return the name of the Tag.
071:             */
072:            public String getTagName() {
073:                return "BindingUpdateErrors";
074:            }
075:
076:            /**
077:             * Sets the expression to match for binding errors.  If an expression
078:             * is set, only binding errors for that expression will be displayed.
079:             * Otherwise, all errors will be displayed.
080:             * @param expression The expression to match against.
081:             * @jsptagref.attributedescription String. The data binding expression to match for binding errors.
082:             * If a data binding expression is specified, only binding errors for that expression will be displayed.
083:             * Otherwise, all errors will be displayed.
084:             * @jsptagref.databindable false
085:             * @jsptagref.attributesyntaxvalue <i>string_databinding_expression</i>
086:             * @netui:attribute required="false" rtexprvalue="true"
087:             * description="The data binding expression to match for binding errors.  If a data binding expression
088:             * is specified, only binding errors for that expression will be displayed.
089:             * Otherwise, all errors will be displayed."
090:             */
091:            public void setExpression(String expression) throws JspException {
092:                _expression = setRequiredValueAttribute(expression,
093:                        "expression");
094:            }
095:
096:            /**
097:             * Set the value which will override the default behavior of not showing
098:             * errors in production mode.
099:             * @param alwaysReport a boolean that if <code>true</code> will cause
100:             *                     the errors to always be displayed.  The default is <code>false</code>
101:             * @jsptagref.attributedescription Boolean. If <code>isAlwaysReport</code> is set to true, then the errors will be displayed in Production mode
102:             * as well as in Development mode.  Otherwise, the errors will be displayed only in Development mode.
103:             * @jsptagref.databindable false
104:             * @jsptagref.attributesyntaxvalue <i>boolean_alwaysReport</i>
105:             * @netui:attribute required="false"  rtexprvalue="true"  type="boolean"
106:             * description="If isAlwaysReport is set to true, then the errors will be displayed in Production mode
107:             * as well as in Development mode.  Otherwise, the errors will be displayed only in Development mode."
108:             */
109:            public void setAlwaysReport(boolean alwaysReport) {
110:                _alwaysReport = alwaysReport;
111:            }
112:
113:            /**
114:             * Render the specified error messages if there are any.
115:             * @throws JspException if a JSP exception has occurred
116:             */
117:            public void doTag() throws JspException {
118:                // report error if there are any
119:                if (hasErrors()) {
120:                    reportErrors();
121:                    return;
122:                }
123:
124:                PageContext pageContext = getPageContext();
125:                ServletContainerAdapter sa = AdapterManager
126:                        .getServletContainerAdapter(pageContext
127:                                .getServletContext());
128:                ServletRequest request = pageContext.getRequest();
129:                assert (sa != null);
130:
131:                // check to see if we are supposed to report the error
132:                boolean prodMode = sa.isInProductionMode();
133:                if (prodMode && !_alwaysReport)
134:                    return;
135:
136:                LinkedHashMap map = (LinkedHashMap) InternalUtils
137:                        .getBindingUpdateErrors(request);
138:
139:                if (map == null)
140:                    return;
141:
142:                if (_expression != null) {
143:                    String expr = "{" + _expression + "}";
144:                    BindingUpdateError err = (BindingUpdateError) map.get(expr);
145:                    if (err != null) {
146:                        Throwable cause = err.getCause();
147:                        String msg = (cause != null) ? cause.getMessage() : err
148:                                .getMessage();
149:                        String s = Bundle.getString("Tags_BindingUpdateError",
150:                                new Object[] { _expression, msg });
151:                        registerTagError(s, null);
152:                        reportErrors();
153:                    }
154:                    return;
155:                }
156:
157:                Iterator it = map.values().iterator();
158:                while (it.hasNext()) {
159:                    BindingUpdateError err = (BindingUpdateError) it.next();
160:                    Throwable cause = err.getCause();
161:                    String msg = (cause != null) ? cause.getMessage() : err
162:                            .getMessage();
163:                    String s = Bundle.getString("Tags_BindingUpdateError",
164:                            new Object[] { err.getExpression(), msg });
165:                    registerTagError(s, null);
166:                }
167:                reportErrors();
168:            }
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.