@Test public void testRender() throws Exception { FreemarkerRenderer freemarkerRenderer = new FreemarkerRenderer(); Assert.assertNotNull(freemarkerRenderer); injectStrutsDependencies(freemarkerRenderer); ActionContext actionContext = ActionContext.getContext(); actionContext.setLocale(Locale.ENGLISH); response.setCharacterEncoding("UTF-8"); freemarkerRenderer.render("/test.ftl", request, response, servletContext, actionContext.getLocale(), actionContext.getValueStack(), null); final String expected = "FreeMarker renderer test. А а Б б В в Г г Д д. Current language - en."; final String resp = response.getContentAsString(); Assert.assertEquals(expected, resp.trim()); }
@Override public void render(final String location, final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext, final Locale locale, final ValueStack valueStack, final Object action) throws IOException, TemplateException { Configuration configuration = freemarkerManager .getConfiguration(servletContext); Template template = configuration.getTemplate(location, locale); TemplateModel model = freemarkerManager.buildTemplateModel(valueStack, action, servletContext, request, response, configuration.getObjectWrapper()); template.process(model, response.getWriter()); }
FreemarkerRenderer implements ViewRenderer { @Override public void render(final String location, final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext, final Locale locale, final ValueStack valueStack, final Object action) throws IOException, TemplateException { Configuration configuration = freemarkerManager .getConfiguration(servletContext); Template template = configuration.getTemplate(location, locale); TemplateModel model = freemarkerManager.buildTemplateModel(valueStack, action, servletContext, request, response, configuration.getObjectWrapper()); template.process(model, response.getWriter()); } }
FreemarkerRenderer implements ViewRenderer { @Override public void render(final String location, final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext, final Locale locale, final ValueStack valueStack, final Object action) throws IOException, TemplateException { Configuration configuration = freemarkerManager .getConfiguration(servletContext); Template template = configuration.getTemplate(location, locale); TemplateModel model = freemarkerManager.buildTemplateModel(valueStack, action, servletContext, request, response, configuration.getObjectWrapper()); template.process(model, response.getWriter()); }  }
FreemarkerRenderer implements ViewRenderer { @Override public void render(final String location, final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext, final Locale locale, final ValueStack valueStack, final Object action) throws IOException, TemplateException { Configuration configuration = freemarkerManager .getConfiguration(servletContext); Template template = configuration.getTemplate(location, locale); TemplateModel model = freemarkerManager.buildTemplateModel(valueStack, action, servletContext, request, response, configuration.getObjectWrapper()); template.process(model, response.getWriter()); }  @Override void render(final String location, final HttpServletRequest request,
                    final HttpServletResponse response,
                    final ServletContext servletContext, final Locale locale,
                    final ValueStack valueStack, final Object action); }
FreemarkerRenderer implements ViewRenderer { @Override public void render(final String location, final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext, final Locale locale, final ValueStack valueStack, final Object action) throws IOException, TemplateException { Configuration configuration = freemarkerManager .getConfiguration(servletContext); Template template = configuration.getTemplate(location, locale); TemplateModel model = freemarkerManager.buildTemplateModel(valueStack, action, servletContext, request, response, configuration.getObjectWrapper()); template.process(model, response.getWriter()); }  @Override void render(final String location, final HttpServletRequest request,
                    final HttpServletResponse response,
                    final ServletContext servletContext, final Locale locale,
                    final ValueStack valueStack, final Object action);  }