【问题标题】:How to store value of var in Spring message tag in java script function?如何在javascript函数的Spring消息标签中存储var的值?
【发布时间】:2016-09-22 12:21:10
【问题描述】:

我有一个函数返回某种字符串 string 是 不是静态的,而是动态的

<code of script function>
var error_msg = sendPinAjaxResponse("some url");

我正在使用 spring 消息标签来更改语言

 $("#error_div").html('<spring:message javaScriptEscape="true" code="static string" />')

当我传递静态字符串时它工作正常

但我想存储 var 的动态值,现在我正在使用 var 'error_msg'

 $("#error_div").html('<spring:message javaScriptEscape="true" code= error_msg />')

jsp 页面出现异常

 quote symbol expected

【问题讨论】:

  • 这个问题似乎与帮助中心定义的范围内的编程无关。

标签: javascript spring spring-mvc jstl spring-messaging


【解决方案1】:

试试看:

$("#error_div").html('<spring:message javaScriptEscape="true" code="' + error_msg + '"/>')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    相关资源
    最近更新 更多