KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > modules > screens > JspScreen


1 package org.apache.turbine.modules.screens;
2
3 /*
4  * Copyright 2001-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License")
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import org.apache.ecs.ConcreteElement;
20 import org.apache.turbine.services.jsp.JspService;
21 import org.apache.turbine.services.TurbineServices;
22 import org.apache.turbine.services.template.TurbineTemplate;
23 import org.apache.turbine.util.RunData;
24 import org.apache.velocity.context.Context;
25 import org.apache.turbine.services.jsp.TurbineJsp;
26
27 /**
28  * Jsp Screen with support for conext. The buildTemplate() assumes the
29  * template parameter has been set in the RunData object. This provides
30  * the ability to execute several templates from one Screen.
31  *
32  * <p>
33  *
34  * If you need more specific behavior in your application, extend this
35  * class and override the doBuildTemplate() method.
36  *
37  * @author <a HREF="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
38  * @author <a HREF="mailto:gabrielm@itcsoluciones.com">Gabriel A. Moreno</a>
39  * @version $Id: JspScreen.java,v 1.1.2.2 2004/05/20 03:03:06 seade Exp $
40  */

41 public class JspScreen extends BaseJspScreen {
42     
43     /**
44      * Jsp Screens extending this class should overide this
45      * method to perform any particular business logic and add
46      * information to the context.
47      *
48      * @param data Turbine information.
49      * @param context Context for web pages.
50      * @exception Exception, a generic exception.
51      */

52     protected void doBuildTemplate( RunData data,
53                                     Context context )
54         throws Exception JavaDoc
55     {
56     }
57
58     /**
59      * Needs to be implemented to make TemplateScreen like us. The
60      * actual method that you should override is the one with the
61      * context in the parameter list.
62      *
63      * @param data Turbine information.
64      * @exception Exception, a generic exception.
65      */

66     protected void doBuildTemplate( RunData data )
67         throws Exception JavaDoc
68     {
69         doBuildTemplate(data, TurbineJsp.getContext(data));
70     }
71
72     /**
73      * Return the Context needed which can then be used in the Jsp template
74      *
75      * @param data Turbine information.
76      * @return A Context.
77      */

78     public static Context getContext(RunData data)
79     {
80         return TurbineJsp.getContext(data);
81     }
82    
83 }
84
Popular Tags