-
1. Re: command link value in datalist
waq Sep 16, 2009 5:43 AM (in response to waq)Can we bind HtmlDatatable with datalist?
-
2. Re: command link value in datalist
nbelaevski Sep 16, 2009 5:51 AM (in response to waq)Hi,
Use actionListener, because you can get component from the ActionEvent. -
3. Re: command link value in datalist
waq Sep 16, 2009 8:02 AM (in response to waq)ok i did as:
<a4j:outputPanel id="guess_div" layout="none"> <rich:dataList value="#{dictionary.dictionayList}" var="dic" type="disc"> <h:commandLink value="#{dic.guess}" styleClass="link" actionListener="#{dictionary.gessView}"/> </rich:dataList> </a4j:outputPanel>
andpublic void gessView(ActionEvent ae) { String wr = ae.getClass().getName(); System.out.println("Value is ..."+wr); }
but its not printing anything -
4. Re: command link value in datalist
waq Sep 16, 2009 9:41 AM (in response to waq)it seems that actionlistener is not being called when commandlink is clicked
-
5. Re: command link value in datalist
waq Sep 17, 2009 10:14 AM (in response to waq)my issue is still not resolved
-
6. Re: command link value in datalist
nbelaevski Sep 17, 2009 1:39 PM (in response to waq)It should be called if action is called for the same component - check server logs, faces messages, etc. for a cause of the problem.
-
7. Re: command link value in datalist
waq Sep 18, 2009 8:56 AM (in response to waq)no its not calling the action method. Nothing is displaying. Let me show you what i m doing:
<a4j:outputPanel id="table_div" layout="none"> <h:dataTable id="detail_table" value="#{dictionary.dictionayList}" var="dic" border="1" rendered="#{dictionary.visible}" headerClass="datatable_width" style="text-align:left;" binding="#{dictionary.dataTable}"> <h:column headerClass="datatable_width"> <f:facet name="header"> <h:outputText value="" /> </f:facet> <h:outputText value="#{dic.word}" styleClass="datatable_text_word"/> </h:column> <h:column headerClass="datatable_width"> <f:facet name="header"> <h:outputText value="" /> </f:facet> <h:outputText value="#{dic.description}" styleClass="datatable_text_desc"/> </h:column> <h:column headerClass="datatable_width"> <f:facet name="header"> <h:outputText value="" /> </f:facet> <h:commandButton value="Details" action="#{dictionary.showDetails}" onclick="showPopup()" /> </h:column> </h:dataTable> </a4j:outputPanel>
Now this table is updated via an ajax call made by button click:<a4j:commandButton value="Search" action="#{dictionary.searchWord}" reRender="detail_table, table_div"
table is populating properly but when i click on command button place inside the datatable, my showDetails is not called. The javascript function showPopup is working properly and it is opening a popup window.
Please tell me where i m doing it wrong. -
8. Re: command link value in datalist
ilya_shaikovsky Sep 21, 2009 9:17 AM (in response to waq)First point: #{dictionary} should be session/conversation scoped because rendered attribute value should be kept between requests. And you have it seems in request scope - so it's lost.
well explained here http://livedemo.exadel.com/richfaces-demo/richfaces/keepAlive.jsf
From the other point - binding should not be pointed to beans which lives more than request. And why you need it at all? -
9. Re: command link value in datalist
waq Sep 23, 2009 5:32 AM (in response to waq)yes that was the mistake.
or alternatively we can also use t:saveState -
10. Re: command link value in datalist
waq Sep 23, 2009 10:24 AM (in response to waq)ok now i got another issue. The FacesMessage is throwing an exception:
SEVERE: java.lang.IllegalStateException javax.faces.el.EvaluationException: java.lang.IllegalStateException at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) at javax.faces.component.UICommand.broadcast(UICommand.java:387) at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55) at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321) at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296) at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253) at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalStateException at com.sun.faces.context.FacesContextImpl.assertNotReleased(FacesContextImpl.java:395) at com.sun.faces.context.FacesContextImpl.addMessage(FacesContextImpl.java:320) at ecs.dictionary.Dictionary.searchWord(Dictionary.java:138) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.el.parser.AstValue.invoke(AstValue.java:152) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) ... 29 more
Exception is thrown when no data is found and i display the message using rich:message. THe code is as under:FacesMessage message = new FacesMessage("Sorry, No record found."); context.addMessage("search_form", message);
<rich:message for="search_form" styleClass="error"/>
-
11. Re: command link value in datalist
waq Sep 23, 2009 11:24 AM (in response to waq)OKay i got the solution. The error was casued because i was storing the context in the instance variable of the bean. We need to call context = FacesContext.getCurrentInstance() everytime the call is made, to avoid java.lang.IllegalStateException.
One more issue that really annoying me is that last time i used t:saveState and it worked perfect. But this time when i use t:saveState instead a4j:keepAlive the action is not called for the commandButton.
Is saveState can be the replacement of keepAlive?