如何在jsf组件中使用javascript变量?

时间:2018-05-07 06:50:52

标签: javascript jsf-2

的index.xhtml

<h:graphicImage title="#{bean.m_strRecentlyUsedImg eq 'Y' ? OMNIGEN.RECENTLY_USED : OMNIGEN.RECENTLY_USED_HIDE}" id="recentlyUsedImg" alt="#{bean.m_strRecentlyUsedImg eq 'Y' ? OMNIGEN.RECENTLY_USED : OMNIGEN.RECENTLY_USED_HIDE}" name="group.png onclick="showRecentlyUsed()" />

的javascript

var m_strRecentlyUsedImg = 'Y';
showRecentlyUsed(){
  m_strRecentlyUsedImg = 'N';

}

这是 bean.java写入getter setter。

public String getM_strRecentlyUsedImg() {
    return m_strRecentlyUsedImg;
}

/**
 * @param m_strRecentlyUsedImg the m_strRecentlyUsedImg to set
 */
public void setM_strRecentlyUsedImg(String m_strRecentlyUsedImg) {
    this.m_strRecentlyUsedImg = m_strRecentlyUsedImg;
}

0 个答案:

没有答案