我有一个a4j:outputPanel。我通过单击页面中的另一个位置来重新渲染它,并且我想在重新渲染 outputPanel
时触发一个操作。
是否有 onrerender 事件或其他事件?我已经尝试过,我已经搜索过,但我无法做我想做的事。 我知道我可以使用 oncomplete 事件来触发重新渲染操作,但这就是 我不想做的事。
不管怎样,你有什么想法吗?我不需要确切的解决方案,只是想法可以帮助我找到实现这一目标的方法。
编辑:抱歉这个错误,我想要触发的操作是一个 js 操作。
最佳答案
尝试放置
<f:event listener="#{myBean.myAction}" type="preRenderComponent"></f:event>
在你的outputPanel
里面...
public void myAction(ComponentSystemEvent componentSystemEvent) {
//some code goes here...
}
<小时/>
如果您想从托管 bean 方法调用 js 代码,您可以使用 Primefaces - RequestContext
public void myAction(ComponentSystemEvent componentSystemEvent) {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.execute("alert('wow')");
}
关于java - jsf 有 onrerender 事件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15088180/