KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > modules > navigations > BaseJspNavigation


1 package org.apache.turbine.modules.navigations;
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
21 import org.apache.turbine.TurbineConstants;
22
23 import org.apache.turbine.services.jsp.TurbineJsp;
24
25 import org.apache.turbine.util.RunData;
26
27 /**
28  * Base JSP navigation that should be subclassed by Navigation that want to
29  * use JSP. Subclasses should override the doBuildTemplate() method.
30  *
31  * @author <a HREF="mailto:john.mcnally@clearink.com">John D. McNally</a>
32  * @author <a HREF="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
33  * @version $Id: BaseJspNavigation.java,v 1.5.2.2 2004/05/20 03:03:53 seade Exp $
34  */

35 public class BaseJspNavigation
36         extends TemplateNavigation
37 {
38     /** The prefix for lookup up navigation pages */
39     private String JavaDoc prefix = TurbineConstants.NAVIGATION_PREFIX + "/";
40
41     /**
42      * Method to be overidden by subclasses to include data in beans, etc.
43      *
44      * @param data the Rundata object
45      * @throws Exception a generic exception.
46      */

47     protected void doBuildTemplate(RunData data)
48         throws Exception JavaDoc
49     {
50     }
51
52     /**
53      * Method that sets up beans and forward the request to the JSP.
54      *
55      * @param data the Rundata object
56      * @return null - the JSP sends the information
57      * @throws Exception a generic exception.
58      */

59     public ConcreteElement buildTemplate(RunData data)
60         throws Exception JavaDoc
61     {
62         // get the name of the JSP we want to use
63
String JavaDoc templateName = data.getTemplateInfo().getNavigationTemplate();
64
65         // navigations are used by a layout
66
TurbineJsp.handleRequest(data, prefix + templateName);
67         return null;
68     }
69 }
70
Popular Tags