FormEntity form = getDao().getFormDao().getByName(formName);
if (form == null) {
return Messages.get("form.not_found", formName);
}
List<FieldEntity> fields = getDao().getFieldDao().getByForm(form);
FormConfigEntity formConfig = getDao().getFormConfigDao().getConfig();
VelocityContext context = getPageBusiness().createContext(
getBusiness().getLanguage(), null);
context.put("formConfig", formConfig);
context.put("form", form);
context.put("fields", fields);
if (StringUtils.isEmpty(formConfig.getFormTemplate())) {
return Messages.get("form.template_is_empty");
}
return getSystemService().render(formConfig.getFormTemplate(),
context);
}
catch (Exception e) {
e.printStackTrace();
return e.getMessage();