KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > phoneList > presentation > DoServerPresentation


1 /*
2  * put your module comment here
3  * formatted with JxBeauty (c) johann.langhofer@nextra.at
4  */

5
6
7 package phoneList.presentation;
8
9 import com.lutris.appserver.server.httpPresentation.*;
10 import phoneList.spec.*;
11
12
13 /**
14  */

15 public class DoServerPresentation
16     implements HttpPresentation {
17
18   public void run (HttpPresentationComms comms) throws Exception JavaDoc {
19     String JavaDoc server = null;
20     try {
21       server = comms.request.getParameter("server");
22     } catch (Exception JavaDoc e) {}
23     String JavaDoc port = null;
24     try {
25       port = comms.request.getParameter("port");
26     } catch (Exception JavaDoc e) {}
27     String JavaDoc okTarget = comms.request.getAppFileURIPath("ListPresentation.po");
28     String JavaDoc errTarget = comms.request.getAppFileURIPath("ErrorPresentation.po");
29     ClientPageRedirectException err = new ClientPageRedirectException(errTarget);
30     ClientPageRedirectException ok = new ClientPageRedirectException(okTarget);
31     if ((server == null) || (server.length() == 0)) {
32       err.addArgument("err", "Error: no server name specified.");
33       throw err;
34     }
35     if ((port == null) || (port.length() == 0)) {
36       err.addArgument("err", "Error: no port value specified.");
37       throw err;
38     }
39     PhoneList phoneList = PhoneListFactory.getPhoneList("phoneList.business.PhoneListImpl");
40    try{
41     phoneList.setServerUrl(server, port);
42    } catch(NullPointerException JavaDoc ex) {}
43    
44     throw ok;
45   }
46 }
47
48
49
50
Popular Tags