1 package org.apache.turbine.modules.navigations;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 264148 2005-08-29 14:21:04Z henning $
34 */
35 public class BaseJspNavigation
36 extends TemplateNavigation
37 {
38 /*** The prefix for lookup up navigation pages */
39 private String 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
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
61 {
62
63 String templateName = data.getTemplateInfo().getNavigationTemplate();
64
65
66 TurbineJsp.handleRequest(data, prefix + templateName);
67 return null;
68 }
69 }