Source Code Cross Referenced for DoActionPresentation.java in  » J2EE » Enhydra-Demos » phoneList » presentation » 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 » Enhydra Demos » phoneList.presentation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package phoneList.presentation;
002:
003:        import com.lutris.appserver.server.httpPresentation.*;
004:
005:        import phoneList.spec.*;
006:
007:        public class DoActionPresentation implements  HttpPresentation {
008:
009:            public void run(HttpPresentationComms comms) throws Exception {
010:                String first = null;
011:                try {
012:                    first = comms.request.getParameter("first");
013:                } catch (Exception e) {
014:                }
015:                String last = null;
016:                try {
017:                    last = comms.request.getParameter("last");
018:                } catch (Exception e) {
019:                }
020:                String phone = null;
021:                try {
022:                    phone = comms.request.getParameter("phone");
023:                } catch (Exception e) {
024:                }
025:                String id = null;
026:                try {
027:                    id = comms.request.getParameter("id");
028:                } catch (Exception e) {
029:                }
030:                String action = null;
031:                try {
032:                    action = comms.request.getParameter("action");
033:                } catch (Exception e) {
034:                }
035:
036:                PhoneList phoneList = PhoneListFactory
037:                        .getPhoneList("phoneList.business.PhoneListImpl");
038:                String okTarget = comms.request
039:                        .getAppFileURIPath("ListPresentation.po");
040:                String errTarget = comms.request
041:                        .getAppFileURIPath("ErrorPresentation.po");
042:                ClientPageRedirectException err = new ClientPageRedirectException(
043:                        errTarget);
044:
045:                if (action.equals("delete")) {
046:                    if ((id == null) || (id.length() == 0)) {
047:                        err.addArgument("err", "Error: no id specified.");
048:                        throw err;
049:                    }
050:                    try {
051:                        phoneList.deletePerson(id);
052:                        /*
053:                         * Catch Null pointer exception ( we canot make a instances of classes from business layer  when we run phoneBookClient_pres )
054:                         * We need  to allow phoneBookClient_pres to be functional 
055:                         */
056:                    } catch (NullPointerException ex) {
057:                        err
058:                                .addArgument("err",
059:                                        "Error: You cannot delete person while runing phoneBookClient_pres!");
060:                        throw err;
061:                    }
062:                } else if (action.equals("edit")) {
063:                    if ((id == null) || (id.length() == 0)) {
064:                        err.addArgument("err", "Error: no id specified.");
065:                        throw err;
066:                    }
067:                    if ((first == null) || (first.length() == 0)) {
068:                        err.addArgument("err",
069:                                "Error: no first name specified.");
070:                        throw err;
071:                    }
072:                    if ((last == null) || (last.length() == 0)) {
073:                        err
074:                                .addArgument("err",
075:                                        "Error: no last name specified.");
076:                        throw err;
077:                    }
078:                    if ((phone == null) || (phone.length() == 0)) {
079:                        err.addArgument("err",
080:                                "Error: no phone number specified.");
081:                        throw err;
082:                    }
083:                    try {
084:                        phoneList.modifyPerson(id, first, last, phone);
085:                        //same thing
086:                    } catch (NullPointerException ex) {
087:                        err
088:                                .addArgument("err",
089:                                        "Error: You  cannot modify  person while runing phoneBookClient_pres!");
090:                        throw err;
091:                    }
092:
093:                } else if (action.equals("create")) {
094:                    if ((first == null) || (first.length() == 0)) {
095:                        err.addArgument("err",
096:                                "Error: no first name specified.");
097:                        throw err;
098:                    }
099:                    if ((last == null) || (last.length() == 0)) {
100:                        err
101:                                .addArgument("err",
102:                                        "Error: no last name specified.");
103:                        throw err;
104:                    }
105:                    if ((phone == null) || (phone.length() == 0)) {
106:                        err.addArgument("err",
107:                                "Error: no phone number specified.");
108:                        throw err;
109:                    }
110:                    try {
111:                        phoneList.addPerson(first, last, phone);
112:                        //same thing
113:                    } catch (NullPointerException ex) {
114:                        err
115:                                .addArgument("err",
116:                                        "Error: You cannot add person while runing phoneBookClient_pres!");
117:                        throw err;
118:                    }
119:
120:                } else {
121:                    // Shouldn't happen.
122:                }
123:
124:                throw new ClientPageRedirectException(okTarget);
125:            }
126:
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.