NIHVIVO-2164 Fix jsp compile errors in propDelete.jsp. Some refactoring.

This commit is contained in:
ryounes 2011-08-11 15:36:28 +00:00
parent 428e917de9
commit 3cbc60d357
8 changed files with 30 additions and 25 deletions

View file

@ -20,6 +20,7 @@
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerConfigurationLoader"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerConfiguration" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper"%>
@ -98,9 +99,7 @@ public WebappDaoFactory getUnfilteredDaoFactory() {
if( subject == null ) throw new Error("could not find subject " + subjectUri);
request.setAttribute("subjectName",subject.getName());
// Get the statement data to display
// rjy7 Alternative implementation: have the template put the markup into a url or form param
// which can then just be spit out here.
// Get the statement data to be displayed
String templateName = request.getParameter("templateName");
Map params = request.getParameterMap();
Map<String, String> statement = new HashMap<String, String>();
@ -121,16 +120,20 @@ public WebappDaoFactory getUnfilteredDaoFactory() {
/* Some propStatements (propStatement-educationalTraining.ftl) make reference to the individual,
* but instead of adding it to the data model we'll test in the template for non-existence. If
* this becomes more common, add it here instead.
* this becomes more common, add it here instead. We don't want to generate the property
* list for the individual, though, so should modify IndividualTemplateModel to make that
* conditional, or perhaps use a different template model that contains only the limited
* information needed in the propStatement templates.
*/
//map.put("individual", new IndividualTemplateModel(subject, vreq));
map.putAll(FreemarkerHttpServlet.getDirectives());
map.putAll(FreemarkerHttpServlet.getMethods());
//map.putAll(FreemarkerHttpServlet.getDirectives());
//map.putAll(FreemarkerHttpServlet.getMethods());
ServletContext context = getServletContext();
FreemarkerConfigurationLoader loader =
FreemarkerConfigurationLoader.getFreemarkerConfigurationLoader(context);
Configuration fmConfig = loader.getConfig(vreq);
FreemarkerConfiguration fmConfig = loader.getConfig(vreq);
fmConfig.resetRequestSpecificSharedVariables();
TemplateProcessingHelper helper = new TemplateProcessingHelper(fmConfig, vreq, context);
statementDisplay = helper.processTemplateToString(templateName, map);
}