[jboss-user] [JBoss Seam] - Re: pages.xml action method fired on ajax requests - must be
gothmog
do-not-reply at jboss.com
Wed Oct 17 05:31:59 EDT 2007
I have an ugly workaround for this and it goes as follows: On the ajax call I also attach an actionListener which sets a flag on my model that the call is indeed an ajax call.
When the page action method runs before rendering, I check this flag and exit straight away if this is set so that the setup logic is not executed on a ajax callback. I also reset the flag as well. So
| <a4j:commandLink
| action="#{maintainComponent.addNewChildComponent}"
| actionListener="#{maintainComponent.isAjax}"
| immediate="true" value="Add new child component"
| reRender="childAttributes" oncomplete="initFileUploads()"
| styleClass="button" />
|
And
| boolean isAjax = false;
| public void isAjax(ActionEvent event) {
| log.info("isAjax()");
| isAjax = true;
| }
|
| private boolean checkAjax() {
| boolean result = isAjax;
| isAjax = false;
| return result;
| }
|
| ...
|
| public void setupRelationshipsView() {
| log.info("setupRelationshipsView():isAjax=" + isAjax);
| if (checkAjax()) return;
| ...
|
|
|
Pretty nasty, it would be good if there was some control over the calling of the action method on pages.xml....
Troy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095957#4095957
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095957
More information about the jboss-user
mailing list