freemarker

FreeMarker template error: The following has evaluated to null or missing | BUT NOT TRUE

南笙酒味 提交于 2019-12-04 05:44:51
The error I'm facing is so weird. Everything looks fine, but I get this error when the browser sends the GET request to the server. What I'm trying to do is actually catching the HTTP parameters, save them in an object saved in an ArrayList sending to a Freemarker template. Could you please help me? Thanks a lot. The error: freemarker.log._JULLoggerFactory$JULLogger error SEVERE: Error executing FreeMarker template FreeMarker template error: The following has evaluated to null or missing: ==> item.lat1 [in template "view/result.ftl" at line 18, column 15] freemarker.core

Netsuite Advanced PDF/HTML code ifelse statement

狂风中的少年 提交于 2019-12-04 05:32:47
问题 I need some assistance in the correct way to format this code for a item fulfillment in Netsuite; <td><#if item.units != null>Units<#else>${tranline.units}</#if></td> I want the PDF form to show the Units of Measure (i.e. units) and if there is no particular UOM specificied for the item, to say UNITS instead of displaying nothing. 回答1: Your example looks correct to me, aside from the values being in the wrong places. In my PDF templates, I do not use NULL, either. Below is how I have a

Remove HTML tags in Freemarker Template

自作多情 提交于 2019-12-04 05:11:02
问题 I've got a freemarker template that displays the same string in a context where HTML is allowed as well as a context where it is not. Is there a built-in in Freemarker that allows me to entirely remove HTML tags from a string? The following template (assuming there was a built-in remove_html ) <#ftl output_format="HTML"/> <html> <head> <title>${page_title?remove_html}</title> </head> <body> <h1>${page_title?no_esc}</h1> </body> </html> and the model Collections.singletonMap("page_title", "A

Freemarker does not assign staticUtil

不羁岁月 提交于 2019-12-04 04:13:42
I worked Application Display Templates on liferay 6.2, I use freemarker help pagination the dynamics data list of liferay. When I upgrade to liferay 7, it is a problem. Liferay 7 use code <#assign records = ddlDisplayTemplateHelper.getRecords(reserved_record_set_id)> for get a records. Old code: <#assign DDLRecordLocalService = serviceLocator.findService("com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService")> <#assign records = DDLRecordLocalService.getRecords(reserved_record_set_id)> <#assign totalRecord = DDLRecordLocalService.getRecordsCount(reserved_record_set_id, 0) > It

FreeMarker Current Date Comparison

有些话、适合烂在心里 提交于 2019-12-04 03:14:29
Is it possible to do date comparisons against the current date in a freemarker template without passing the current date into the template? From FreeMarker 2.3.17 on you can use the new special variable .now : [#assign foo = .now > yesterday?datetime] noob In case someone else has this issue. I was comparing 2 dates [#assign .now?date lte today?date] (they both were 10/10/2019 ) but for some reason it was false even though it was equal, so what I had to do was [#assign .now?string["dd/MM/yyyy"]?date lte today?date] Better way to compare two dates in freemarker is to find the difference between

Limit string length in FreeMarker

非 Y 不嫁゛ 提交于 2019-12-04 01:32:32
I'm trying to get a substring from a string in FreeMarker. However there are 2 thigns to consider: The string can be null The string can be shorter then the maximum string length I do the following: <#list landingpage1.popularItems as row> <li> <span class="minititle"> <#assign minititle=(row.title!"")> <#if minititle?length < 27> ${minititle} <#else> ${minititle?substring(0,26)} ... <#/if> </span> </li> </#list> I get a freemarker error saying: Failed to load templates: Encountered "</#list>" at line 144, column 65 in landingpage1.ftl. Was expecting one of: <ATTEMPT> ... <IF> ... <LIST> ...

#技术分享# 查询引擎的设计思路与落地

隐身守侯 提交于 2019-12-04 00:15:14
在上一家公司的产品实施过程中,按照8/2原则,感觉多数的的业务访问都是基于CRUD中的R完成的,即通过简单抑或复杂的查询条件完成各式各样的操作操作,最终把结果展示在UI层,实现用户对查询结果预览等。结合(DDD)领域驱动模型CQRS架构风格,把业务高度抽象为Read与Wirte 两种模式,其中基于Read模式的实现 ,在系统开发的过程中分装了一个查询引擎,用的尚且不错,故把设计的一些思路分享给大家.... 就怕贻笑大方。 废话少说,转入正题:话说那年冬天,天气蒙蒙亮,一个鬼影鬼魅般的出现在庭院中间......咳咳咳 严重跑题了。 针对Read查询业务,按照业务的驱动,应该具备如下的一些业务诉求: 1、查询引擎的SQL是面向JDBC的,用户可快速编写SQL同时可对SQL进行不断的优化(这里区别于 基于 一些 ORM框架 例如 JPA ) 2、编辑后的SQL文件可热加载,整个过程无需重启服务器(文件包含 新增、删除、修改等) 这是针对SQL文件而言 3、引擎支持分页查询,用户无需查询两次后去结果在进行装配结果(SQL语句还是自己编写 -- 亦可自动生成 ) 4、支持多样性的查询条件装配以及防止SQL注入 5、支持查询结果的元数据描述以及数据结果的自动格式化操作,前端拿到无需在此渲染可直接展示,减少对UI的二次加工 6、支持并发查询,并对结果集汇总,到了JDK8的时代

How do I use a template code generator (eg freemarker) in Maven?

一笑奈何 提交于 2019-12-04 00:11:20
How would you structure Freemarker (or an alternative) as a templating code generator into a Maven project? I'm pretty new to Maven and would appreciate some help. I want to generate some code from templates in my project. [a] Rather than write my own, googling found freemarker which appears to be used by Spring which is a good enough reference for me, though as I haven't started with it yet, any other suggestions that work well with Maven would be appreciated too. This website tells me how to add it as a dependency to my pom.xml. This SO question tells me where the generated sources should go

elipse中freemarkerIDE下载和安装

主宰稳场 提交于 2019-12-03 22:35:48
freemarkerIDE 功能 : 支持语法高亮,语法校验,代码提示的工具 freemarker IDE(JBoss) 安装: 可以直接下载下载下来安装,但在FreeMaker官方上直接下载下来的是0.94版;现在的最新版本是1.3.100.Final,最新版可以在Eclipse中在线安装,支持最新的Eclipse4.3.1版。 在线安装地址: http://download.jboss.org/jbosstools/updates/development/ 安装方法: eclipse --> Help --> Install New Software --> Add --> Location 输入 http://download.jboss.org/jbosstools/updates/development/ 如果只是需要freemarker编辑器,安装时只要勾选其中freemarker一个选项就行。 来源: oschina 链接: https://my.oschina.net/u/948547/blog/183792

JAVA Freemarker(1)--入门示例

ぐ巨炮叔叔 提交于 2019-12-03 18:59:15
1、新建一个WEB工程, 下载(我使用的是freemarker-2.3.20)freemarker并导入freemarker.jar,在WEB-INF下新建文件夹templates用于存放模版文件 在templates下新建test.ftl,这是示例模版文件。内容就是HTML内容,里面带有一个标记符,用于将来进行变量替换,内容如下: Html代码 < html > < head > < title > freemarker测试 </ title > </ head > < body > < h1 > ${message},${name} </ h1 > </ body > </ html > 2、新建一个Servlet,用于请求设置变量,并处理模版的输出: Java代码 package com.cloud.wyscha.servlet; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet