HTML 中的 struts2 标签使用错误



My struts 2 服务器端操作有一个方法

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]
<@s.if test="%{homeAddress}"> dosomething </@s.if>   

终于工作了

最新更新