2014-10-01 132 views
0

爲什麼我收到此錯誤:當使用Velocity模板與把手

org.apache.velocity.exception.ParseErrorException: Encountered "btnBreakPrivateStartDisabled" at /templates/przerwy/askbreaks.vm[line 14, column 97] 
Was expecting: 
"(" ... 

這樣的:

<input type="button" id="button_break_private_start" class="breakButtons" 
{{#if btnBreakPrivateStartDisabled}}disabled{{/if}} 
value="$action.getText('break.ask.private')" 
onclick="window.location.href='$req.contextPath/plugins/requests/requestprivatebreak.action'"/> 

回答

2

#if被解釋爲Velocity directive,由於括號圍繞所需Velocity語法中的條件表達式會產生您在上面看到的錯誤。你的語法表明你的意思是#if指令由Handlebars處理。目前還不清楚你是如何調用把手的,但是如果你需要在你的輸出中代表文字#if,你可以escape the #

請注意,Confluence已經內置支持Soy templates(Google Closure模板)。如果這些可能符合你的需求代替Handlebars,它們將允許你直接編寫.soy模板,而無需通過Velocity並且不必擔心逃跑。