freemarker

Can't load static file while in route “/post/:postId” in spark-java framework

走远了吗. 提交于 2019-12-12 03:29:43
问题 In my spark-java project, I put css file and js file into folder static in src/main/resources . I use Spark.staticFileLocation("/static") to set the static file path. When I use get("/posts", (req, res) ->{...}) , css and js file can load correctly. The path is http://0.0.0.0:4567/css/style.css , it works well. But when I want to get the single post by postId get("/post/:postId", (req, res) ->{...}) , it can't load the css and js file correctly. The path become http://0.0.0.0:4567/post/css

Converting Dates Freemarker

半城伤御伤魂 提交于 2019-12-12 02:34:20
问题 I'm trying to get the following to work but I can't get the correct value to display. Assuming SHIPPING_DATE is treated as a string with the value = 2016/05/23: <#setting date_format="MM/dd/yyyy"> <#setting locale="en_US"> <#assign ship_date>${SHIPPING_DATE}</#assign> ${ship_date?date("MM/dd/yyyy")} The output is 12/05/0190 but I'm expecting 05/23/2016 . Will someone help but also explain what I'm doing wrong, please? 回答1: If you have a string in ship_date like 2016/05/23 , then you can parse

freemarker : cast “Interface” Object to the real concret class

早过忘川 提交于 2019-12-12 01:54:37
问题 I iterate to a list of IColonne object. But I need to cast to the concret class to get specific attribut. My list have "Colonne" and "ColonneGroup" object. The IColonne interface : public interface IColonne { String getFtlName(); int getWidthPx(final int tableSize); } The Colonne concrete class: public class Colonne implements IColonne { .... } The ColonneGroup concret class : public class ColonneGroup implements IColonne { private List<String> texts; } I need to access to access to the

untime - Template processing error: "No mapping defined for spring framework tags

断了今生、忘了曾经 提交于 2019-12-12 01:22:26
问题 My current development environment is java 6, spring framework 3.2, weblogic 10.3.6 and using Freemarker templates. Everything is working fine in current environment, don't see any runtime issues while browsing pages. IDE: eclipse kepler 4.3 and I am running weblogic server from eclipse IDE. My deployment assembly is from m2e plugin that comes with kepler. Now I am upgrading to latest Weblogic 12.1.2 and java 7. I am able to successfully build, deploy and publish the module but while

How to access values from alfresco-global.properties in freemarker and YUI javascript files

时光怂恿深爱的人放手 提交于 2019-12-12 00:08:37
问题 I have numerous custom variables in Alfresco's alfresco-global.properties file that I'd like to use throughout various freemarker ftl files as well as the various YUI files, which will greatly alter the behavior of Share and how it displays information. I have the property values accessible through various javascript calls (for example, getNetworkName() will return the custom app.network.name variable set in the properties), but I am uncertain of how I'd expose these javascript functions to

Any tutorials on setting up a templating framework on GAE (Java)?

北慕城南 提交于 2019-12-11 20:13:02
问题 I'm trying to format our emails by using HTML-formatted templates on Google App Engine (using Java), but for the life of me I cannot find a decent tutorial for how to set this up. I've tried looking at StringTemplate, but I cannot find any examples where a stand-alone template is loaded from a servlet's context and used as a formatter. Can anyone help? I'm open to any suggestions, such as Velocity or FreeMarker, so long as they run on GAE. Thanks 回答1: Figured out how to do it. The

Freemarker - flat structure of passing parameters, transfer to array of objects

元气小坏坏 提交于 2019-12-11 20:02:07
问题 How to eval this kind of parameters or I need to pass JSON? I can change structure of parameters: "news[0].title" or " news.0.title" or anything else but I wouldn't like to ask users of my API to form json. @Autowired private TemplateEmailBodyPreparer preparer; public void doIt() { Map<String,String> properties = new HashMap<String,String>() {{ put("news[0].title", "Title 1"); put("news[0].body", "Body 1"); put("news[1].title", "Title 2"); put("news[1].body", "Body 2"); }}; String result =

Post the new events to the backend controller

孤人 提交于 2019-12-11 16:47:05
问题 I am trying to use JQuery Full Calendar along with Spring MVC. I have made a demo like that. Target: I need to send the UPDATED calendar's data,after I enter my events, to the controller to handle it. Issue: I've succeded to re-send the calendar I've inistialzed to the controller. However,I can't send the updated calendar's data,after I enter my events, to the controller to handle it. Freemarker: <script type="text/javascript"> var calendar; var calendarData; function doAjax() { var test =

Freemarker template is not replaced with data model

邮差的信 提交于 2019-12-11 14:56:25
问题 I have followed the steps given in this link Demo and I am able to print out the template but after calling the below code and when I print html, it returns back the template minus the data. For example, "Dear ${user}," is simply "Dear ," String html = FreeMarkerTemplateUtils.processTemplateIntoString(t, model); Am I missing something.I don't see any TemplateException. 来源: https://stackoverflow.com/questions/49138167/freemarker-template-is-not-replaced-with-data-model

FreeMarker Complex Collection

谁说胖子不能爱 提交于 2019-12-11 13:53:35
问题 I've got a HashMap as Map<Long, List<Map<String, Object>>> typeAndKno , in the FreeMarker page, I get the content of this map like this: <#list typeAndKno?keys as typeId> ${typeAndKno.get(typeId).get(0).get('TYPE_NAME')} <#list typeAndKno.get(typeId) as kno> ${kno.get('KNOWLEDGE_ID')} </#list> </#list> This code works fine in Struts2, but after moved to Spring MVC, the code fails. I finally changed the code to this: <#list typeAndKno?keys as typeId> ${typeAndKno[typeId]?first['TYPE_NAME']} <