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
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
39 extends TemplateNavigation
40 {
41 /*** The prefix for lookup up navigation pages */
42 private String prefix = TurbineConstants.NAVIGATION_PREFIX + "/";
43
44 /***
45 * Method to be overidden by subclasses to include data in beans, etc.
46 *
47 * @param data the Rundata object
48 * @throws Exception a generic exception.
49 */
50 protected void doBuildTemplate(RunData data)
51 throws Exception
52 {
53 }
54
55 /***
56 * Method that sets up beans and forward the request to the JSP.
57 *
58 * @param data the Rundata object
59 * @return null - the JSP sends the information
60 * @throws Exception a generic exception.
61 */
62 public ConcreteElement buildTemplate(RunData data)
63 throws Exception
64 {
65
66 String templateName = data.getTemplateInfo().getNavigationTemplate();
67
68
69 TurbineJsp.handleRequest(data, prefix + templateName);
70 return null;
71 }
72 }