View Javadoc

1   package org.paneris.jal.controller;
2   
3   import org.webmacro.Template;
4   import org.webmacro.servlet.HandlerException;
5   import org.webmacro.servlet.PanerisPage;
6   import org.webmacro.servlet.WebContext;
7   
8   /**
9    * Dummy servlet that simply returns a template specified in the query string.
10   */
11  public class Dummy extends PanerisPage {
12  
13    private static final long serialVersionUID = 1L;
14  
15  /**
16   * @throws HandlerException on unpredicted error
17   **/
18      public Template handle(WebContext context) throws HandlerException {
19          String db = (String)context.getForm("db");
20          context.put("db",db);
21          String templateName = (String)context.getForm("templateName");
22          // return the appropriate template
23          try {
24              return (Template) context.getBroker().get("template",templateName);
25          } catch (Exception e) {
26              throw new HandlerException("Could not locate template: " + templateName);
27          }
28      }
29  
30  }