KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > enhydraFlash > presentation > Welcome


1 /*
2  *
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  *
22  * $Id: Welcome.java,v 1.2 2004/08/16 10:57:12 slobodan Exp $
23  */

24 package enhydraFlash.presentation;
25
26 import java.util.Date JavaDoc;
27 //import com.lutris.xml.xmlc.*;
28
import com.lutris.appserver.server.httpPresentation.*;
29
30 public class Welcome implements HttpPresentation {
31
32
33     public void run(HttpPresentationComms comms)
34         throws HttpPresentationException {
35     String JavaDoc name = null;
36     try {
37         if((name = comms.request.getParameter("name")) != null) {
38         handleSubmit(comms, name);
39         }
40         else {
41         WelcomeHTML welcome = (WelcomeHTML)comms.xmlcFactory.create(WelcomeHTML.class);
42         comms.response.writeDOM(welcome);
43         }
44     } catch (Exception JavaDoc e) {
45         System.out.println("EXCEPTION in Welcome" + e);
46     }
47     }
48
49     public void handleSubmit(HttpPresentationComms comms, String JavaDoc name) {
50     
51     //Put the name in the session.
52
try {
53         comms.session.getSessionData().set("NAME", name);
54         String JavaDoc test = comms.session.getSessionData().getString("NAME");
55         throw new ClientPageRedirectException("ShowName.po");
56     } catch (Exception JavaDoc e) {
57         System.out.println("EXCEPTION in Welcome" + e);
58     }
59     }
60
61 }
62
Popular Tags