当鼠标移动到界面的特定元素上时,如何在 JSF 应用程序中显示简单的消息?我已经尝试过这段代码,但它不起作用,没有显示任何消息:
JSF 文件:
<h:form id ="f">
<h:selectManyCheckbox onmouseover="#{hello.message()}" layout="pageDirection" border="1" value="#{hello.customersSelect}">
<f:selectItems value="#{hello.customers}"></f:selectItems>
</h:selectManyCheckbox><br />
<h:commandButton action="response.xhtml" value="Click me" />
</h:form>
支持 bean Hello (ManagedBean) 包含方法 message() 如下:
public void message(){
FacesContext.getCurrentInstance().addMessage("f", new FacesMessage("Done"));
}
我想我应该在某处添加一个标签 h:message,但我无法完成它,尽管我很努力。有什么提示吗?