freemarker

How to Pass Workflow Propert in Control-Parm to FTL File in Alfresco?

不打扰是莪最后的温柔 提交于 2019-12-11 10:46:06
问题 So for my project, we have some javascript code running as a rule within the Alfresco repository. So whenever a new document comes into a certain space, a new folder is dynamically created and that document is moved into that newly created space. Additionally, whenever a new folder is created, a property is updated like so for the document (expect caseID is actually a dynamically generated value based on a sequence in our database): //Add caseID as a property of the folder var props = new

Convert Calendar to ISO 8601 Format DateTime String?

一笑奈何 提交于 2019-12-11 10:04:40
问题 I'm trying to output the datePublished field in a Google AMP schema object. For example: <script type="application/ld+json"> { ... "datePublished": "2005-10-22T00:00Z", ... } </script> The datePublished field in my JCR app is rendering as a FreeMarker Calendar (e.g. Oct 21, 2005 7:00:00 PM ) in the template. How do I convert a data type of Calendar to an ISO 8601 format DateTime string (e.g. 2005-10-22T00:00Z )? 回答1: Use the FreeMarker string.iso_m_u built-in. For example: <script type=

How is struts finding css files?

故事扮演 提交于 2019-12-11 08:47:56
问题 I'm working with struts 2. In my JSP I have a <s:head /> tag. Somhow this triggers this css links to be inserted into the final HTML file: <link href="/app/styles/design.css" rel="stylesheet" type="text/css" media="all"/> <link href="/app/styles/print.css" rel="stylesheet" type="text/css" media="print"/> <link rel="stylesheet" href="css/flick/jquery-ui-1.10.0.xyz.min.css" /> How does struts know about this files? How can I add other CSS files or change them? 回答1: Struts UI tags generate HTML

Freemarker get-method without “get”

喜夏-厌秋 提交于 2019-12-11 07:44:58
问题 How can I access method/field, using the following syntax: ${object.foo} ? What i want is: if there is a public field, named foo, then it's value returns, else if there is a getter, named getFoo(), then it calls and result of call returns, else if there is a method, named foo(), then it calls and result of call returns. Is it possible in Freemarker? 回答1: Since you can write your own ObjectWrapper implementation it's possible, although if you need more than object.foo to work (like, exposing

Freemarker “.vars” names can't contain dashes?

好久不见. 提交于 2019-12-11 06:29:40
问题 We're using Freemarker version 2.3.16, and I've just tracked down a weird bug in one of our apps. It came down to there now being hyphens in some of our product code strings. The codes are used to pull hashes of localized text from the global scope using .vars . Reducing the issue brought me to an example that anyone can try: ${.vars["foo-bar"]} in a template outputs 0 ${.vars["foo+bar"]} outputs nullnull ${.vars["foobar"]} correctly triggers an InvalidReferenceException All three should

How to register attribute renderer in Apache Tiles?

两盒软妹~` 提交于 2019-12-11 03:37:26
问题 on the Integration with FreeMarker page on the Apache Tiles site it has: To access ".ftl" files as attributes, register FreeMarkerAttributeRenderer this way (only available in a servlet environment): @Override protected void registerAttributeRenderers( BasicRendererFactory rendererFactory, TilesApplicationContext applicationContext, TilesRequestContextFactory contextFactory, TilesContainer container, AttributeEvaluator evaluator) { super.registerAttributeRenderers(rendererFactory,

freemarker中Bean的包装

时光毁灭记忆、已成空白 提交于 2019-12-11 02:57:05
reemarker.ext.beans.BeansWrapper 是一个对象包装器**, 最初加到FreeMarker中是为了将任意的POJO(Plan Old Java Objects,普通的Java对象) 包装成 TemplateModel 接口类型。** 这样它就可以以正常的方式来进行处理,事实上 DefaultObjectWrapper 本身是 BeansWrapper 的扩展类。 这里描述的所有东西对 DefaultObjectWrapper 都是适用的, 除了 DefaultObjectWrapper 会用到 freemarker.template.SimpleXxx 类包装的String,Number, Date,array, Collection(如List), Map,Boolean 和 Iterator对象,会用 freemarker.ext.dom.NodeModel 来包装W3C的DOM结点(更多关于包装的W3C DOM 可以参考这里…), 所以上述这些描述的规则不适用。 模板方法模型功能(TemplateMethodModel functionality) 一个对象的所有方法作为 TemplateMethodModelEx 对象的表述, 它们在对象模型的方法名中使用哈希表的键来访问。 当使用 model.method(arg1, arg2, …)

How to display date time as local time without the timezone at the end?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 02:32:15
问题 EDIT: Due to some seeming confusion, let me clarify. If at all possible I want the solution to be done IN freemarker and not in java. I have a datetime string that looks like this: 2019-03-12T16:02:00+02:00 I have to show this in a specific format like this: EEEE dd. MMMM yyyy HH:mm However, if I do it like this it shows the time as 14:02 instead of 16:02 . It converts the datetime to UTC and then displays it. How do I make it display the hours and minutes as is, just without "utc" at the end

can freemarker do second replacement

懵懂的女人 提交于 2019-12-11 00:14:31
问题 Usually i use this type of data in freemarker: (root) | +- website = "StackOverflow" | +- href = "http://stackoverflow.com" | +- label = "my favorite website." but today,a java programmer give me a model like this: (root) | +- website = "StackOverflow" | +- href = "http://stackoverflow.com${dir}" | +- label = "my favorite website" | +- dir = "/questions/ask" And he wants me to show dir's value in the final page. The template: ${label}<a href="${href}" >${website}</a> i suggested him to write

Repositioning the cursor with freemarker

醉酒当歌 提交于 2019-12-10 22:09:22
问题 I am working with free marker and java. I have to output result on a txt file. Say i have to print for 3 columns as `A B C` In the similar patter. All three attributes as string. Condition is that, if the length of string referring to A is more than 3 than it should be printed in the next line. That is if the length is 8 then first 3 character will be in first line, 4 to 6 in second and the remaining two in third. Now after that when I have to print for B, i would have to come back to the