2013-06-27 47 views
0

我試圖把一個javascript函數參數放入Spring消息中,並且失敗。使用javascript函數參數作爲彈簧消息標記參數

消息文件條目:

operators.delete.confirm=Are you sure you want to delete {0}? 

相應的JavaScript片段:

var msg = '<spring:message code="operators.delete.confirm" arguments="${username}" javaScriptEscape="true"/>'; 
console.log (msg); 
console.log (username); 

我希望爲103用戶名的輸出爲Are you sure you want do delete 103?,但不被使用的參數。控制檯日誌消息的輸出是:

[19:00:14.926] Are you sure you want to delete {0}? 
[19:00:14.926] 103 

我哪裏出錯了?

回答

0

我意識到這實際上沒有意義。 Spring消息標籤在服務器上的JSP頁面中被解析,而JavaScript變量僅在客戶端上可用。