0
我有这样的片段:A4J:的commandButton的onComplete的javascript忽略
<h:form> <h:panelGrid columns="2" styleClass="modalYesNo"> <a4j:region id="confirmActionReloadYes"> <a4j:commandButton value="Yes" ajaxSingle="true" action="#{MyBacking.reloadConfig}" oncomplete="window.location.reload()" reRender="blah" /> </a4j:region> <a4j:commandButton value="No" onclick="#{rich:component('confirmActionReload')}.hide();return false;" /> </h:panelGrid> </h:form>
和我注意到,当在A4J是按钮:上述区域被选择,一旦背衬bean方法reloadCongi()
完成,javascript window.location.reload()
未运行。为什么是这样?我还注意到reRender属性中的元素也不会被重新渲染。为什么是这样?
编辑 从对这个问题的第一个注释的方法是:
public void reloadConfig() {
logger.info("Reloading config.");
pct = pctBackup;
feeds = pct.getFeed();
setSysMsg("Reloaded config OK.", "ok");
}
我想也许我需要根据上面的返回类型设置为true或false,看看是否有作品。
很奇怪。你的代码看起来很好。我通过在oncomplete事件中放置'alert('oncomplete run')'来测试你的代码,并且它会运行并弹出提醒。你的'reloadConfig()'真的完成了,没有任何错误吗? – 2011-04-01 13:39:29
我将添加该方法作为编辑 – volvox 2011-04-01 14:27:43