{
String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
// The ID must be passed in the templateId parameter.
int templateId = Integer.parseInt(request.getParameter("templateId"));
// Get the detail from the EJB world ...
PrintTemplateVO templateVO = null;
Collection templateCategories = null;
try {
PrintTemplate remoteEJB = (PrintTemplate)CVUtility.setupEJB("Printtemplate", "com.centraview.printtemplate.PrintTemplateHome", dataSource);
templateVO = remoteEJB.getPrintTemplate(templateId);
templateCategories = remoteEJB.getCategories();
} catch (Exception e) {
throw new ServletException(e);
}
// ... and populate the DynaActionForm
DynaActionForm templateForm = (DynaActionForm)form;
templateVO.populateFormBean(templateForm);
// Stick the template types (categories) list on the formbean.
templateForm.set("typeList", templateCategories);
TemplateUtil.setNavigation(request, "detail");
// forward to the display screen
return mapping.findForward(".view.administration.view_template");