html中struts2标记用法的错误

时间:2014-12-15 16:14:19

标签: struts2

我的struts 2 Serverside操作有一个方法

public boolean isHomeAddress() {
    return true;
}

我的观点(html)包含以下代码

<@s.if test="${homeAddress == true}"> dosomething </@s.if>
<@s.elseif test="someexpression"> else worked </@s.elseif>
<@s.else> no condition passed</@s.else>

我收到错误

----
Tip: If you just want "true"/"false" result as you are generting computer-language output, use "?c", like ${myBool?c}.
----
Tip: You can write myBool?string('yes', 'no') and like to specify boolean formatting in place.
----
Tip: If you need the same two values on most places, the programmers should set the "boolean_format" setting to something like "yes,no".


----
FTL stack trace ("~" means nesting-related):
    - Failed at: ${homeAddress == true}  [in template "freemarker/myaccount/mobile/orderTracking.html" at line 132, column 30]
    - Reached through: @s.if test="\${homeAddress == true}"  [in template "freemarker/myaccount/mobile/orderTracking.html" at line 132, column 17]

1 个答案:

答案 0 :(得分:0)

<@s.if test="%{homeAddress}"> dosomething </@s.if>   

终于工作了