本文整理汇总了Java中freemarker.ext.servlet.FreemarkerServlet类的典型用法代码示例。如果您正苦于以下问题:Java FreemarkerServlet类的具体用法?Java FreemarkerServlet怎么用?Java FreemarkerServlet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FreemarkerServlet类属于freemarker.ext.servlet包,在下文中一共展示了FreemarkerServlet类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildTemplateModel
import freemarker.ext.servlet.FreemarkerServlet; //导入依赖的package包/类
/**
* Build a FreeMarker template model for the given model Map.
* <p>The default implementation builds a {@link AllHttpScopesHashModel}.
* @param model the model to use for rendering
* @param request current HTTP request
* @param response current servlet response
* @return the FreeMarker template model, as a {@link SimpleHash} or subclass thereof
*/
protected SimpleHash buildTemplateModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
AllHttpScopesHashModel fmModel = new AllHttpScopesHashModel(getObjectWrapper(), getServletContext(), request);
fmModel.put(FreemarkerServlet.KEY_JSP_TAGLIBS, this.taglibFactory);
fmModel.put(FreemarkerServlet.KEY_APPLICATION, this.servletContextHashModel);
fmModel.put(FreemarkerServlet.KEY_SESSION, buildSessionModel(request, response));
fmModel.put(FreemarkerServlet.KEY_REQUEST, new HttpRequestHashModel(request, response, getObjectWrapper()));
fmModel.put(FreemarkerServlet.KEY_REQUEST_PARAMETERS, new HttpRequestParametersHashModel(request));
fmModel.putAll(model);
return fmModel;
}
示例2: buildTemplateModel
import freemarker.ext.servlet.FreemarkerServlet; //导入依赖的package包/类
protected SimpleHash buildTemplateModel(Map<String, Object> model, WebContext rc) {
AllHttpScopesHashModel fmModel = new AllHttpScopesHashModel(getObjectWrapper(), rc.getContext(), rc.getRequest());
fmModel.put(FreemarkerServlet.KEY_JSP_TAGLIBS, this.taglibFactory);
fmModel.put(FreemarkerServlet.KEY_APPLICATION, this.servletContextHashModel);
fmModel.put(FreemarkerServlet.KEY_SESSION, buildSessionModel(rc.getRequest(), rc.getResponse()));
fmModel.put(FreemarkerServlet.KEY_REQUEST, new HttpRequestHashModel(rc.getRequest(), rc.getResponse(), getObjectWrapper()));
fmModel.put(FreemarkerServlet.KEY_REQUEST_PARAMETERS, new HttpRequestParametersHashModel(rc.getRequest()));
fmModel.putAll(model);
return fmModel;
}
示例3: buildTemplateModel
import freemarker.ext.servlet.FreemarkerServlet; //导入依赖的package包/类
@Override
protected SimpleHash buildTemplateModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
SimpleHash hash = super.buildTemplateModel(model, request, response);
hash.put(FreemarkerServlet.KEY_INCLUDE, new IncludePage(request, response));
return hash;
}