使用onclick事件在JSF中转义JavaScript引号

时间:2015-11-24 06:59:11

标签: javascript jsf

onclick="window.open('/pages/PDocPreview.jsf?nid=#{pBeanDetail.id}&loadfirst=1&edit=true&fromPage=true&currentName=#{pBeanDetail.dName}&pId=#{pBeanDetail.user.id}', 'popupWindowName', 'dependent=yes, menubar=no, scrollbars=yes, resizable=1,toolbar=no,left =5, top=5, width=1100, height=800');"

此处,在currentName=#{pBeanDetail.dName}部分,当值包含'时,我将遇到问题。

我检查了很多可能性但在页面打开时收到错误。

  1. 使用内部输出文本
  2. 使用JSTL fn标签lib
  3. 1&组合2
  4. 代码示例:(不工作)

    currentName=<h:outputText value="#{fn:replace(pBeanDetail.dName,'\'', '\\'')}"></h:outputText>
    


    currentName=#{fn:replace(pBeanDetail.dName,'\'', '\\'')}
    


    *此问题与类似问题不同,因为我需要在Javascript事件中使用带有fn功能的EL表达式

0 个答案:

没有答案