freemaker if 多个条件_Freemarker替代[语法]如果条件有数字(Freemarker alternative[syntax] if condition with number)...

Freemarker替代[语法]如果条件有数字(Freemarker alternative[syntax] if condition with number)

我正在使用替代的freemarker语法(带方括号的语法)。 它工作正常,但我无法弄清楚如果条件检查数字是否大于或小于如何使用。 以下是我的语法

[#if ${numberCoupons} <= 1]

[#assign couponsText = 'coupon']

[/#if]

这里“

还有任何可以与freemarker的替代语法一起使用的整个指令列表的文档吗?

I am using alternative freemarker syntax(the one with square brackets). It works fine but I am not able to figure out how to use if condition to check if a number is greater than or less than. Following is the syntax I have

[#if ${numberCoupons} <= 1]

[#assign couponsText = 'coupon']

[/#if]

Here "

Also is there any documentation for list of entire directives that can be used with alternative syntax of freemarker?

原文:https://stackoverflow.com/questions/12759680

2020-02-07 21:59

满意答案

您应该能够使用以下任何一项:

[#if (numberCoupons <= 1)]

[#if numberCoupons <= 1]

[#if numberCoupons lte 1]

[#if numberCoupons \lte 1]

我会用parens。

向下滚动一点到该部分中以“有一点问题”开头的最后一段

You should be able to use any of the following:

[#if (numberCoupons <= 1)]

[#if numberCoupons <= 1]

[#if numberCoupons lte 1]

[#if numberCoupons \lte 1]

I would use the parens.

Scroll down just a little to the last paragraph in that section that starts with "There is a little problem"

2012-10-08

相关问答

哇。 长时间没有看到这种语法。 这是在块开发过程中探索的各种语法结构之一。 它最终被拒绝了,因为它在声明意图时太不精确,并且由此产生的行为会令人困惑。 考虑一个有三个块的作用域,其中两个通过|a|声明一个变量为readwrite 。 没有办法从int a = 5;知道int a = 5; 声明在范围的顶部,变量的值在某些块的范围内被读取。 同样,这会使编译器的实现更加困难。 C中的传统是变量存储类型在声明时是固定的。 支持这种语法会打破这种期望。 因此,决定使用类似于volatile或static...

请参阅https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF的逻辑运算符部分 现在支持NOT IN查询。 A NOT IN(val1,val2,...)| 布尔| 如果A不等于任何值,则为TRUE。 从Hive开始,NOT IN语句支持0.13子查询。 See the Logical Operators section of https://cwiki.apache.org/confluence/display/Hiv...

使用这个,你只是在你的函数中错过了() 。 function checkNum2($n)

{

$r = !is_numeric($n) ? "not numeric" : ($n<0 ? "less than zero" : "greater then or equal to zero");

return $r;

}

echo checkNum2($num); # echoes "not numeric";

工作示例http://codepad.viper-7.com/DVvQ...

尝试 if (!(listbox == 'lhs' || listbox == 'prevnext')) {

要么 if (listbox != 'lhs' || listbox != 'prevnext') {

Try if (!(listbox == 'lhs' || listbox == 'prevnext')) {

or if (listbox != 'lhs' || listbox != 'prevnext') {

问题是 stat -f "%OLp" $file

是您需要执行的命令,并将结果与644进行比较。 所以我们应该使用命令替换来在子shell中运行命令。 if [ $(stat -f "%OLp" $file) -gt 644 ]; then

$( )运行命令并将其替换为命令的输出。 测试 $ if [ $(stat -f "%OLp" $file) -gt 644 ]; then

> echo Greater than 644;

> else

> echo Less than ...

我可以想到的两个选项... 按位 #define TILE_W 0x0001

#define TILE_A 0x0002

#define TILE_S 0x0004

#define TILE_D 0x0008

if (tile&(TILE_w|TILE_A|TILE_S|TILE_D))

{

printf("legal\n");

return true;

}

开关的情况下 switch (tile)

{

case w:

case a:

case s:

case d:

p...

您应该能够使用以下任何一项: [#if (numberCoupons <= 1)]

[#if numberCoupons <= 1]

[#if numberCoupons lte 1]

[#if numberCoupons \lte 1]

我会用parens。 详情请见: http : //freemarker.sourceforge.net/docs/dgui_template_exp.html#dgui_template_exp_comparison 向下滚动一点到该部分中以“有一点问...

更简单的方法是在FreeMarker中不这样做:-)这听起来像控制器(或模型上的方法)应该做的事情而不是查看模板。 也就是说,你有几个选择: 使用 / 块内置的内置号码。 在你的一个模型对象中写一个方法来检查你的字符串是否是一个数字并从模板中调用它。 写一个自定义指令为你做这个。 The simpler way is to not do it in FreeMarker :-) This sounds like something controller (o...

$this->db->where('title', 'Book');

$this->db->from('my_table');

echo $this->db->count_all_results();

// Produces an integer, like 17

$this->db->where('title', 'Book');

$this->db->from('my_table');

echo $this->db->count_all_results();

// Produces an ...

它不起作用,因为大于号的符号被视为#if标记的结尾。 所以实际上你有 ,而id不是布尔值。 尝试 1)> 。 (顺便说一句,只需编写category.id 。无需在FreeMarker中get...() 。) It doesn't work because the greater-than sign is seen as the end of the #if tag. So in effect you ha...

相关文章

Java Number类 一般地,当需要使用数字的时候,我们通常使用内置数据类型,如:byte、

...

模板技术在现代的软件开发中有着重要的地位,而目前最流行的两种模板技术恐怕要算freemarker和ve

...

在maven pom.xml文件中加入spring-boot和freemarker的依赖,可以再app

...

写like语句的时候 一般都会写成 like '% %' 在mybatis里面写就是应该是

...

如果你使用FreeMarker作为springmvc的ViewResolver时,也许你会遇到更改ft

...

上一节我们接触了一个FreeMarker很简单的例子FreeMarker入门教程,说到底,就是替换模板

...

大家好: 现在有个问题,麻烦大家帮解答下。假设说有个集合。我现在要过滤这个集合,条件数目是不定的,装

...

在Java模板引擎 FreeMarker介绍中,我们已经对freemarker有了一定的了解,这一节是

...

各位大虾、请问一下Freemarker取值小数点的问题。 使用 Freemarker 取小数点一位。

...

我们上一节认识了FreeMarker基本数据类型,接口认识FreeMarker集合(List、Map)

...

最新问答

如果启用了复制处理程序,请确保将其置于其中一个安全角色之后。 我见过人们做的另一件事是在不同的端口上运行admin。 最好在需要auth的页面上使用SSL,这样你就不会发送明确的密码,因此管理和复制将发生在8443上,而常规查询将在8080上发生。 如果您要签署自己的证书,请查看此有用的SO页面: 如何在特定连接上使用不同的证书? I didn't know that /admin was the context for SOLR admin because /admin does not re

第一:在您的样本中,您有: 但是你在询问 //td[@class=‘CarMiniProfile-TableHeader’] (注意TableHeader中的大写'T')。 xpath区分大小写。 第二:通过查询// td [@ class ='CarMiniProfile-TableHeader'] / td,你暗示你在外部td中有一个'td'元素,而它们是兄弟姐妹。 有很多方法可以在这里获得制作和模型

这是你的答案: http://jsfiddle.net/gPsdk/40/ .preloader-container { position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; background: #FFFFFF; z-index: 5; opacity: 1; -webkit-transition: all 500ms ease-out;

问题是,在启用Outlook库引用的情况下, olMailItem是一个保留常量,我认为当您将Dim olMailItem as Outlook.MailItem ,这不是问题,但是尝试设置变量会导致问题。 以下是完整的解释: 您已将olMailItem声明为对象变量。 在赋值语句的右侧,在将其值设置为对象的实例之前,您将引用此Object 。 这基本上是一个递归错误,因为你有对象试图自己分配自己。 还有另一个潜在的错误,如果之前已经分配了olMailItem ,这个语句会引发另一个错误(可能是

我建议使用wireshark http://www.wireshark.org/通过记录(“捕获”)设备可以看到的网络流量副本来“监听”网络上发生的对话。 当您开始捕获时,数据量似乎过大,但如果您能够发现任何看起来像您的SOAP消息的片段(应该很容易发现),那么您可以通过右键单击并选择来快速过滤到该对话'关注TCP Stream'。 然后,您可以在弹出窗口中查看您编写的SOAP服务与Silverlight客户端之间的整个对话。 如果一切正常,请关闭弹出窗口。 作为一个额外的好处,wireshar

Android默认情况下不提供TextView的合理结果。 您可以使用以下库并实现适当的aligntment。 https://github.com/navabi/JustifiedTextView Android Does not provide Justified aligntment of TextView By default. You can use following library and achieve proper aligntment. https://github.com/

你的代码适合我: class apples { public static void main(String args[]) { System.out.println("Hello World!"); } } 我将它下载到c:\ temp \ apples.java。 以下是我编译和运行的方式: C:\temp>javac -cp . apples.java C:\temp>dir apples Volume in drive C is HP_PAV

12个十六进制数字(带前导0x)表示48位。 那是256 TB的虚拟地址空间。 在AMD64上阅读wiki(我假设你在上面,对吗?)架构http://en.wikipedia.org/wiki/X86-64 12 hex digits (with leading 0x) mean 48 bits. That is 256 TB of virtual address space. Read wiki on AMD64 (I assume that you are on it, right?) ar

这将取决于你想要的。 对象有两种属性:类属性和实例属性。 类属性 类属性对于类的每个实例都是相同的对象。 class MyClass: class_attribute = [] 这里已经为类定义了MyClass.class_attribute ,您可以使用它。 如果您创建MyClass实例,则每个实例都可以访问相同的class_attribute 。 实例属性 instance属性仅在创建实例时可用,并且对于类的每个实例都是唯一的。 您只能在实例上使用它们。 在方法__init__中定

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值