freemarker

Apache camel multicast FreeMarker

為{幸葍}努か 提交于 2019-12-13 02:25:30
问题 I need to send two different XMLs (by FreeMarker) to two different endpoints. i.e. .to("freemarker:templates/xml1.ftl").to("file://C:\\testXmls1") and .to("freemarker:templates/xml2.ftl").to("file://C:\\testXmls2") I had a look at the multicast() function but I don't know how to apply it when there are two .to Could anyone please help me? 回答1: Yes you can specify multiple endpoints in the same .to(uri1, uri2, ...) then it becomes as a single "eip". multicast() .to(uri1a, uri1b) .to(uri2a,

struts2 and freemarker template

和自甴很熟 提交于 2019-12-13 01:50:51
问题 i use struts2 on my web app, in one jsp file i display 3 arraylist in a form using "iterator". when i launch my app with tomcat everything works fine. but i would like to make it works with websphere6.1, but when i launch it now the page take 20-30 second to appears, with tomcat it was lass than 1 second. here is the logs i have on my websphere console : (freemarker.cache 81 ) Could not find template in cache, creating new one; id=[template/simple/form.ftl[fr_FR,UTF-8,parsed] ] i have almost

FreeMarker(二):利用FreeMarker转pdf

三世轮回 提交于 2019-12-12 19:47:42
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1. 设计需求 订票成功后,生成一个pdf 文件,用户打印入场票,门票大致如下所示: 2. 设计思想 1). 使用FreeMarker 转换 ftl(就是FreeMarker 魔板文件),生成HTML 2). 使用jtidy库将 HTML转换成 对格式要求严格的 XHTML 3 ) . 使用Itext 库将XHTML转换成PDF 3. Demo 创建 简介:本项目是在Maven 的环境中搭建的,其pom.xml 主要导入的依赖如下: <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.28</version> </dependency> <dependency> <groupId>com.itextpdf.tool</groupId> <artifactId>xmlworker</artifactId> <version>5.5.6</version> </dependency> <dependency> <groupId>net.sf.jtidy</groupId> <artifactId>jtidy</artifactId> <version>r938</version

How to pass multiple checkboxes to the Action

心已入冬 提交于 2019-12-12 18:29:49
问题 I am using Struts 2 and Freemarker. This is my action class: package test; import java.util.ArrayList; import java.util.List; public class WelcomeAction { private String userName; private String gender; private List<String> fruits; private String fruit; public String execute() { // if(!userName.equals("a")) // { // return "fail"; // } // else { // return "SUCCESS"; // } return "SUCCESS"; } public String getUserName() { return userName; } public void setUserName(String userName) { this

My FreeMarker method returns a string with ${variable} — how to force FreeMarker to parse that?

这一生的挚爱 提交于 2019-12-12 13:04:58
问题 I've created a class that implements TemplateMethodModelEx from FreeMarker. Pretend the exec() function returns a String: "Hello ${username}" I assign the class to a method in the data model: dataModel.put("myMethod", myClassInstance); dataModel.put("username", "John Doe"); My HTML template looks like this: <p>${myMethod()}</p> Which means that the following output is generated, when the template is processed: <p>Hello ${username}</p> Since there is actually a username value in my data model,

@spring.formInput in #list iterator

元气小坏坏 提交于 2019-12-12 12:51:09
问题 <#list flowList as flow> <@spring.formInput "flow.createDatetime" /> </#list> flowList is arrayList. freemarker.template.TemplateModelException: Method public org.springframework.web.servlet.support.BindStatus org.springframework.web.servlet.support.RequestContext.getBindStatus(java.lang.String) throws java.lang.IllegalStateException threw an exception when invoked on org.springframework.web.servlet.support.RequestContext@8bc713e with arguments of types [java.lang.String,] at freemarker.ext

Struts 2 + Sitemesh 3 integration - NPE in FreemarkerDecoratorServlet

一个人想着一个人 提交于 2019-12-12 11:10:53
问题 I am using Struts 2 (version 2.3.14.3) together with Sitemesh 3 (version 3.0-alpha-2) and I am getting a NullPointerException under cerain circumstances. First, here is my struts2 / sitemesh configuration from web.xml: <filter-mapping> <filter-name>struts-prepare</filter-name> <url-pattern>*.do</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>*.do</url-pattern> <dispatcher

How to access a Spring application property in a Freemarker template?

蓝咒 提交于 2019-12-12 10:00:38
问题 I have Java webapp that uses Spring 3.1, with Freemarker templates for rendering the view. I want to conditionally display a link in the view, based on the true/false value of a particular application property. I have the following app property defined in src/main/resources/application.properties : showLink=true If I were using a regular JSP with Spring MVC, I could use SpEL to conditionally display the link based on the value of showLink : <c:if test="${configuration['showLink']}"> <a href="

Freemarker WebappTemplateLoader in FreemarkerConfigurer

我怕爱的太早我们不能终老 提交于 2019-12-12 05:18:24
问题 Anyone has an example on how to use Freemarker WebappTemplateLoader in FreemarkerConfigurer? I am using Freemarker with Spring MVC and extending the FreeMarkerConfigurer to add various template loaders and I would also like to add a web app loader to load templates in web app context. But I do not know how to get the servletcontext parameter for its constructor. public class DesktopFreeMarkerConfigurer extends FreeMarkerConfigurer{ @Override protected void postProcessConfiguration

HTTP Status 405 - Request method 'POST' not supported. Spring Security

心已入冬 提交于 2019-12-12 04:31:33
问题 I have Spring Security with Spring MVC. When I try to sign up, it is giving me 405 'POST' not supported. I have disabled csrf token in security config. Let me know where did I go wrong? My login page: <#-- @ftlvariable name="error" type="java.util.Optional<String>" --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Log in</title> </head> <body> <nav role="navigation"> <ul> <li><a href="/">Home</a></li> </ul> </nav> <h1>Log in</h1> <p>You can use: demo@localhost / demo<