-
1. Re: a4j:commandLink doesn’t reacts at first click
healeyb Apr 30, 2012 6:37 AM (in response to arkhalil)It would be helpful to see the code, what kind of panel is it, a popupPanel? if so there are a couple of possible fixes.
-
2. Re: a4j:commandLink doesn’t reacts at first click
arkhalil Apr 30, 2012 7:19 AM (in response to healeyb)You can see the sample code as an example:
................................................................................
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j">
<h:form id="menuform">
<a4j:commandLink value="News" action="#{menueController.loadNewsList()}" render="bodyPanel"/>
</h:form>
<a4j:outputPanel id="bodyPanel">
<h:form id="newsform">
<a4j:commandLink value="More Info" action="#{newsController.loadNewsDetail()}" render="newsDetailPanel"/>
</h:form>
<a4j:outputPanel id="newsDetailPanel">
<h:outputText value="#{newsBean.detail}" />
</a4j:outputPanel>
</a4j:outputPanel>
</ui:composition>
................................................................................
Thanks.
-
3. Re: a4j:commandLink doesn’t reacts at first click
healeyb Apr 30, 2012 10:12 AM (in response to arkhalil)The problem is with the multiple forms. It's easily fixed by removing newsform and extending menuform to wrap
the lower outputPanel. Why is it happening? there is a mojarra jira about this but java.net is still down so I can't
find it, but I remember it's something to do with the viewState.
With the use of ajax and the ability to control what gets submitted to the server with execute= I personally feel
that there's a good argument for using a single form per page (except in rare circumstances such as some file
upload and dialog box implementations), and you don't get caught by easy-to-forget naming container mishaps,
and problems such as this one.
Regards,
Brendan.
-
4. Re: a4j:commandLink doesn’t reacts at first click
arkhalil Apr 30, 2012 1:45 PM (in response to healeyb)Yes, That sounds good. Thanks for guiding.
-
5. Re: a4j:commandLink doesn’t reacts at first click
healeyb May 1, 2012 6:49 AM (in response to arkhalil)Ok, java.net is back again. I'm reasonably sure you're hitting this limitation: http://java.net/jira/browse/JAVASERVERFACES-1718,
because you have a form (newsform) nested within an ajax target (bodyPanel) where the request originates from another form
(menuform).
The issue has been closed and this is being treated as a spec issue: http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1024,
so please vote for it if you want it fixed.
Note that there is a workaround given in the -1718 bug report if you can live with editing jsf.js.
Regards,
Brendan.
-
6. Re: a4j:commandLink doesn’t reacts at first click
arkhalil May 3, 2012 2:07 PM (in response to healeyb)1 of 1 people found this helpfulYes, You are right. But I resolved my issue using a4j:jsFunction in the following way for the time being:
................................................................................
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j">
<h:form id="menuform">
<a4j:commandLink value="News" action="#{menueController.loadNewsList()}" render="bodyPanel"/>
<a4j:jsFunction name="loadNewsDetailJsFunction" action="#{newsController.loadNewsDetail()}" render="newsDetailPanel">
</a4j:jsFunction>
</h:form>
<a4j:outputPanel id="bodyPanel">
<a href="#" onclick="loadNewsDetailJsFunction();">More Info</a>
<a4j:outputPanel id="newsDetailPanel">
<h:outputText value="#{newsBean.detail}" />
</a4j:outputPanel>
</a4j:outputPanel>
</ui:composition>
................................................
Brendan, Thank you very much for bringing a very common JSF issue in notice.