commandLink does not work within a dataTable
Hi, I have got a problem with the commandLink-components within a dataTable. The connected actionListener-method is never executed and the same view is displayed without any changes. It is a very weird problem, because a quite similar view with commandLinks in a dataTable does work(!) and this one not!! I could not find any reason why it is not working: t:dataTable id=articletypesByProductlevel var=articletyp ... h:column f:facet name=header h:outputText value=Bezeichnung/ /f:facet h:commandLink id=chooseArticletypeLnk actionListener=#{createArticleBean.chooseArticletype} h:outputText id=itemtext value=#{articletyp.itemtext}/ /h:commandLink h:inputHidden id=id value=#{articletyp.id}/ /h:column ... t:datatable The generated Html-Code: a href=# onclick=clear_createArticleForm();document.forms['createArticleForm'].elements['autoScroll'].value=getScrolling(); document.forms['createArticleForm'].elements['createArticleForm:_link_hidden_'].value='createArticleForm:articletypesByProductlevel_ 0:chooseArticletypeLnk'; if(document.forms['createArticleForm'].onsubmit){if(document.forms['createArticleForm'].onsubmit()) document.forms['createArticleForm'].submit();}else{document.forms['createArticleForm'].submit();}return false; id=createArticleForm:articletypesByProductlevel_0:chooseArticletypeLnk span id=createArticleForm:articletypesByProductlevel_0:itemtextRollenfalz/span/a input type=hidden id=createArticleForm:articletypesByProductlevel_0:id name=createArticleForm:articletypesByProductlevel_0:id value=4 / Even if the actionListener attribute of the commandLink-component contains a value that does not map to a backing bean method, there is no error thrown. Is this known problem? Has anyone the same problem? Is there a solution or should I simply not use a commandLink within a dataTable? Regards, Ünsal
AW: commandLink does not work within a dataTable
Hi Geeta, Thank you for your answer, but could you explain what thelist has to do with my problem? I suppose that you mean with "list"the value-attribute of the dataTable-component, which is in my case a Collection of model-objects. Regards, Ünsal Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Montag, 9. Januar 2006 15:36An: MyFaces DiscussionBetreff: Re: commandLink does not work within a dataTable [EMAIL PROTECTED] wrote on 01/09/2006 06:14:07 AM: Hi, I have got a problem with the commandLink-components within a dataTable. The connected actionListener-method is never executed and the same view is displayed without any changes. It is a very weird problem, because a quite similar view with commandLinks in a dataTable does work(!) and this one not!! I could not find any reason why it is not working: t:dataTable id="articletypesByProductlevel" var="articletyp" ... h:column f:facet name="header" h:outputText value="Bezeichnung"/ /f:facet h:commandLink id="chooseArticletypeLnk" actionListener="#{createArticleBean.chooseArticletype}" h:outputText id="itemtext" value="#{articletyp.itemtext}"/ /h:commandLink h:inputHidden id="id" value="#{articletyp.id}"/ /h:column ... t:datatable Hi Unsal, you have two choices (that I know of!): either place your list in session scope or use t:saveState for your list. Regards, Geeta
AW: AW: commandLink does not work within a dataTable
Hi Geeta, thank you very much, the problem is solved. Your guess was absolutely correct. After I taken care that the collection is available after the Restore View phase everything works fine. Regards, Ünsal Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Montag, 9. Januar 2006 16:37An: MyFaces DiscussionBetreff: Re: AW: commandLink does not work within a dataTable [EMAIL PROTECTED] wrote on 01/09/2006 10:22:46 AM: Hi Geeta,Thank you for your answer, but could you explain what the list has to do with my problem? Well Ünsal, I am not at all an expert in JSf but here's what I believe happens (and I hope somebody will correct me if I am wrong or incomplete): if your list of objects is only in request scope then your page will be displayed ok. However after the Restore View phase, your collection will be thrown away. So when you click on an entry in your table, this action is processed as part of the "Process Events" phase as part of the *next* request (so *after* the collection has been gced). Which is why you need to save your collection either in session scope or via t:saveState. I suppose that you mean with "list" the value-attribute of the dataTable-component, which is in my case a Collection of model-objects. Yes, this is what i mean. Regards, Ünsal Regards, Geeta