01: package org.apache.turbine.modules.navigations;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21:
22: import org.apache.ecs.ConcreteElement;
23:
24: import org.apache.turbine.TurbineConstants;
25:
26: import org.apache.turbine.services.jsp.TurbineJsp;
27:
28: import org.apache.turbine.util.RunData;
29:
30: /**
31: * Base JSP navigation that should be subclassed by Navigation that want to
32: * use JSP. Subclasses should override the doBuildTemplate() method.
33: *
34: * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
35: * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
36: * @version $Id: BaseJspNavigation.java 534527 2007-05-02 16:10:59Z tv $
37: */
38: public class BaseJspNavigation extends TemplateNavigation {
39: /** The prefix for lookup up navigation pages */
40: private String prefix = TurbineConstants.NAVIGATION_PREFIX + "/";
41:
42: /**
43: * Method to be overidden by subclasses to include data in beans, etc.
44: *
45: * @param data the Rundata object
46: * @throws Exception a generic exception.
47: */
48: protected void doBuildTemplate(RunData data) throws Exception {
49: }
50:
51: /**
52: * Method that sets up beans and forward the request to the JSP.
53: *
54: * @param data the Rundata object
55: * @return null - the JSP sends the information
56: * @throws Exception a generic exception.
57: */
58: public ConcreteElement buildTemplate(RunData data) throws Exception {
59: // get the name of the JSP we want to use
60: String templateName = data.getTemplateInfo()
61: .getNavigationTemplate();
62:
63: // navigations are used by a layout
64: TurbineJsp.handleRequest(data, prefix + templateName);
65: return null;
66: }
67: }
|