日期:2014-05-18  浏览次数:20717 次

js传值为EL表达式

<a href="javascript:void()" onclick="go(${(map.pagetotal)!""})">Go</a>



页面报
Multiple annotations found at this line:
- Invalid location of text ("})") in tag (<a>).
- Syntax error, insert ")" to complete Arguments
- Syntax error, insert ")" to complete 
 PrimaryNoNewArray
- Missing semicolon
- Syntax error, insert "}" to complete Block


可以正常访问
JavaScript

------解决方案--------------------
<a href="javascript:void()" onclick="go(${(map.pagetotal)!''})">Go</a>,改成单引号,试试
------解决方案--------------------
那LZ的意思,功能正常,但提示错误?
------解决方案--------------------
引用:
Quote: 引用:

<a href="javascript:void()" onclick="go(${(map.pagetotal)!''})">Go</a>,改成单引号,试试


一样的

<a href="javascript:void()" onclick="go(${map.pagetotal})">Go</a>


这样也不行
你把我的代码粘贴过去,我看着怎么不一样
------解决方案--------------------
- Syntax error, insert "}" to complete Block
 看看你的两个 } 颜色都不一样
试试
转义字符
------解决方案--------------------
<a href="javascript:void()" onclick="go('${map.pagetotal}')">Go</a> 这样写才合理

------解决方案--------------------
${(map.pagetotal)!""}这个是freemarker表达式吧 , el 应该是 ${map.pagetotal}

------解决方案--------------------
 onclick="go(${(map.pagetotal)!eq ''})"


试试这个你是不是判断为不为空!!!
------解决方案--------------------