velocity

Velocity upgrade from 1.7 to 2.0

半腔热情 提交于 2021-02-08 06:38:33
问题 I am trying to migrate from velocity 1.7 where I use LogChute interface. In my current implementation I have used the log method to get the velocity log level and comparing our own log level. Please see the code below. @Override public void log(int level, String message) { LogLevel projLevel = null; switch ( level ) { case LogChute.DEBUG_ID: projLevel = LogLevel.DEBUG ; break ; case LogChute.INFO_ID: projLevel = LogLevel.INFO ; break ; case LogChute.WARN_ID: projLevel = LogLevel.WARNING ;

Escaping special characters in velocity template

浪尽此生 提交于 2021-02-08 04:57:07
问题 I have this template in vm: <div> $submitterMessage </div> The variable $submitterMessage contains the special character like è,à,ò. In my template the output of variable is: � � � � How I can resolve it? Thanks 回答1: In that context you should apply HTML encoding/escaping. According to velocity a ready function is: http://velocity.apache.org/tools/devel/generic/EscapeTool.html#html%28%29 For a more complex context like: html attributes, nested javascript etc... you could use also ESAPI by

Calling Macro function in Velocity template

北慕城南 提交于 2021-02-06 15:14:01
问题 I am trying to figure out how to return a value from a velocity macro call and assign it to a varaible my macro function looks something like this. its once in common shared macros files #macro(getBookListLink, $readingTrackerResult) $readingTrackerResult.getBookListLink() #end I am need to assign the result of this macro to a variable in another velocity template file I tried something like this #set($book_list_link = #getBookListLink( $readingTrackerResult )) but did not work. I tried with

Calling Macro function in Velocity template

心已入冬 提交于 2021-02-06 15:11:12
问题 I am trying to figure out how to return a value from a velocity macro call and assign it to a varaible my macro function looks something like this. its once in common shared macros files #macro(getBookListLink, $readingTrackerResult) $readingTrackerResult.getBookListLink() #end I am need to assign the result of this macro to a variable in another velocity template file I tried something like this #set($book_list_link = #getBookListLink( $readingTrackerResult )) but did not work. I tried with

Calling Macro function in Velocity template

与世无争的帅哥 提交于 2021-02-06 15:10:41
问题 I am trying to figure out how to return a value from a velocity macro call and assign it to a varaible my macro function looks something like this. its once in common shared macros files #macro(getBookListLink, $readingTrackerResult) $readingTrackerResult.getBookListLink() #end I am need to assign the result of this macro to a variable in another velocity template file I tried something like this #set($book_list_link = #getBookListLink( $readingTrackerResult )) but did not work. I tried with

VTL: How it recognizes images

ⅰ亾dé卋堺 提交于 2021-01-29 19:30:37
问题 We documentate all our programs with VTL, and when you print them there are images where they shouldn't be . We cannot modify each one of them because there are thousand of pages. I wanted to put a macro at the beginning that detects the images , and put a page-breaker before them. So , the problem is, I cannot find how VTL recognizes the images when looping through the code. 来源: https://stackoverflow.com/questions/60299737/vtl-how-it-recognizes-images

VTL: How it recognizes images

不羁的心 提交于 2021-01-29 14:50:11
问题 We documentate all our programs with VTL, and when you print them there are images where they shouldn't be . We cannot modify each one of them because there are thousand of pages. I wanted to put a macro at the beginning that detects the images , and put a page-breaker before them. So , the problem is, I cannot find how VTL recognizes the images when looping through the code. 来源: https://stackoverflow.com/questions/60299737/vtl-how-it-recognizes-images

css not getting applied for velocity template in Liferay Theme

无人久伴 提交于 2021-01-29 02:05:29
问题 I am using LIferay Theme to create a theme for a website. IN the portal_normal.vm file, I have included all the html code and css I have defined in custom.css THe problem is that css from custom.css is not getting applied to portal_normal.vm page SHould I include some file in velocity file which tells that custom.css should be included? Also is it ok to include all css code in velocity? Regards EDIT: custom.css and portal_normal.vm are inside _diffs folder 回答1: put the custom.css under ~

css not getting applied for velocity template in Liferay Theme

无人久伴 提交于 2021-01-29 02:04:04
问题 I am using LIferay Theme to create a theme for a website. IN the portal_normal.vm file, I have included all the html code and css I have defined in custom.css THe problem is that css from custom.css is not getting applied to portal_normal.vm page SHould I include some file in velocity file which tells that custom.css should be included? Also is it ok to include all css code in velocity? Regards EDIT: custom.css and portal_normal.vm are inside _diffs folder 回答1: put the custom.css under ~

css not getting applied for velocity template in Liferay Theme

浪尽此生 提交于 2021-01-29 02:02:04
问题 I am using LIferay Theme to create a theme for a website. IN the portal_normal.vm file, I have included all the html code and css I have defined in custom.css THe problem is that css from custom.css is not getting applied to portal_normal.vm page SHould I include some file in velocity file which tells that custom.css should be included? Also is it ok to include all css code in velocity? Regards EDIT: custom.css and portal_normal.vm are inside _diffs folder 回答1: put the custom.css under ~