使用 a4j:commandLink 和属性 actionListener 时不调用 bean
您好,我想在 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>
我的searchBean代码:
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,但效果不佳。
Hi I want to use actionListner
in a commandLink
.
<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>
My searchBean code:
public class SearchBean {
public void search(ActionEvent e)
{
String myAttribute = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("keyWord").toString();
System.out.println(myAttribute);
}
}
But there is no call to the bean.
I tried using f:attribute
and h:commandLink
instead of a4j but that didn't work as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试去掉actionListener函数名末尾的空格
Try to remove the blank space at the end of the actionListener function name
你在哪里声明你的bean?如果你没有为它选择一个特定的名称,jsf 在上下文中将其命名为降低第一个字符。即 #{searchBean}
Where did you declare your bean?If you didnt pick a spesific name for it,jsf names it in the context as lowering the first character.i.e. #{searchBean}