KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > phoneList > presentation > ModifyServerPresentation


1 package phoneList.presentation;
2
3 import phoneList.spec.*;
4
5 // Standard imports
6
import java.util.Vector JavaDoc;
7 import java.io.IOException JavaDoc;
8
9 // Enhydra SuperServlet imports
10
import com.lutris.appserver.server.httpPresentation.HttpPresentation;
11 import com.lutris.appserver.server.httpPresentation.HttpPresentationComms;
12 import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
13 import org.w3c.dom.html.HTMLAnchorElement;
14 import org.w3c.dom.Node JavaDoc;
15
16 public class ModifyServerPresentation implements HttpPresentation {
17   
18   private static ModifyServerHTML ms;
19   
20   public void run(HttpPresentationComms comms) throws HttpPresentationException, IOException JavaDoc {
21
22     try{
23       modifyServer(comms);
24     }catch(Exception JavaDoc e){
25       e.printStackTrace();
26     }
27   }
28
29
30   public static void modifyServer(HttpPresentationComms comms) throws Exception JavaDoc {
31     ms = (ModifyServerHTML)comms.xmlcFactory.create(ModifyServerHTML.class);
32     try{
33        PhoneList phoneList = PhoneListFactory.getPhoneList("phoneList.business.PhoneListImpl");
34       
35        String JavaDoc server=phoneList.getServer();
36        String JavaDoc port=phoneList.getPort();
37       
38     
39       ms.getElementPort().setValue(port);
40       ms.getElementServer().setValue(server);
41       
42 /*
43  * Catch Null pointer exception ( we canot make a instances of classes from business layer when we run phoneBookClient_pres )
44  * We need to allow phoneBookClient_pres to be functional ,return default HTML page
45  */

46     } catch(NullPointerException JavaDoc ex) {}
47    comms.response.writeDOM(ms);
48    }
49
50 }
51
52
Popular Tags