您好,我想在commandLink
中使用actionListner
<ui:define name="content">
<a4j:log/>
<a4j:form id="home">
<h:commandLink value="bla" actionListener="#{SearchBean.search }">
<f:param name="keyWord" value="hello"></f:param>
</h:commandLink>
//some more JSF
</a4j:form>
</ui:define>
我的搜索bean代码:
public class SearchBean {
public void search(ActionEvent e)
{
String myAttribute = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("keyWord").toString();
System.out.println(myAttribute);
}
}
但是没有调用bean。我尝试使用f:attribute
和h:commandLink
而不是a4j,但没有工作,以及
尝试删除actionListener函数名末尾的空格
您在哪里声明您的bean?如果您没有为它选择一个特定的名称,那么jsf将在上下文中将其命名为降低第一个字符。# {searchBean}