-
1. Re: How to Reload the conversation with the flushed data from data base using s:link
mkouba Sep 13, 2012 7:15 AM (in response to kishi_kiran)Hi,
if I undestand your use case correctly you have menu with links, each link begins a new long-running conversation and redirects user to some page with dataTable (e.g. executionPlanList). Meanwhile some background operation may change the displayed data. So you need to refresh the data showed on the page. Is this correct?
Well, I wouldn't create a new conversation. Simply reload the data in the current conversation. Add a refresh method to the conversational component that handles subpage actions/data, and use:
1) <s:link> or <s:button> with action="#{component.refresh}" and without propagation="none" (the conversation id is propagated automatically)
2) ajax component like RichFaces <a4j:commandLink> with action="#{component.refresh}" and rerendering the datatable (the conversation id should be propagated automatically, if not try adding <s:conversationId/>)
HTH
-
2. Re: How to Reload the conversation with the flushed data from data base using s:link
kishi_kiran Sep 13, 2012 8:01 AM (in response to mkouba)Hi Martin, Thanks for reply
you understood what exactly I need.
I have tried first one like
<s:link action="#{component.refresh}" view="/view/execution/executionplans.seam">
<h:graphicImage value="/images/header_images/images/refresh.png"/>
</s:link>
and with out view attibute it is giving some error like
16:59:56,069 ERROR [Exceptions] handled and logged exception
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'component' resolved to null
at org.jboss.el.parser.AstValue.getTarget(AstValue.java:38)
at org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
at org.jboss.seam.navigation.Pages.callAction(Pages.java:704)
at org.jboss.seam.navigation.Pages.preRender(Pages.java:331)
at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:560)
at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:471)
at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:147)
at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:117)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
Target Unreachable, identifier 'component' resolved to null - please try again (Application error).
in the browser url:
before click refresh
after refresh:
and in the 2nd way
<a4j:commandLink action="#{component.refresh}">
<h:graphicImage value="/images/header_images/images/refresh.png"/>
</a4j:commandLink>
it does not give any error and no change in URL, still the datatable is not getting updated.
is that correct what i modified in the xhtml file? or do i need to chage any thing more apart from xhtml.
-
3. Re: How to Reload the conversation with the flushed data from data base using s:link
mkouba Sep 13, 2012 8:15 AM (in response to kishi_kiran)Sure you need . Sorry, I was a little bit unclear . You have to replace component in #{component.refresh} with the name of your own Seam component that performs the refresh (e.g. fetch the data from the database) and of course implement this method (as I wrote above). This component probably holds the dataTable data already.
-
4. Re: How to Reload the conversation with the flushed data from data base using s:link
kishi_kiran Sep 14, 2012 2:54 AM (in response to mkouba)Hi I have tried either way, like..
<s:link action="#{logit.ui.executionPlanBean.refresh}" view="/view/execution/executionplans.seam">
<h:graphicImage value="/images/header_images/images/refresh.png"/> </s:link>
but its giving error : Method not found: com.logit.ui.execution.ExecutionPlanBean@1859ae.refresh() - Please try again
Here the scenario like, i have a main menu tab, when i click the new conversation begin and in that page i have a datatable which is geting populated with new data changes,(the data changes/updations wil happend through xml files)
so insted of clicking my main menu tab i have placed a refresh link to populate the updated data in the datatable,
here ExecutionPlanBean is my class which is in conversation scope, in this i have a mehtod like getExecutionPlansForCompany(){...} which is populating the DataTable data,
so when I tried like this
<s:link action="#{logit.ui.executionPlanBean.getExecutionPlansForCompany()}" view="/view/execution/executionplans.seam">
<h:graphicImage value="/images/header_images/images/refresh.png"/></s:link>
then when i click the refresh button, its populating the data without errors, and mean while i have processed one xml files which is to create a new row on the datatable,
then i click button now the new row is populated and then i have processed another xml which is to update some columns in the existing data of datatable, then i click refresh now it does not work, updated columns data is not populated.. this is my problem
and one thing when i click the main menu tab in the url like
http://localhost:8080/glog/view/execution/executionplans.seam?conversationPropagation=begin
when i click the refresh url is changed
is that the right way to refresh the component, what i did here?
And also another scenario is like when i click one of the column in the datatable, it opens another page and which is also having datatable ,
URL like this when click one of the column: http://localhost:8080/glog/view/execution/executionPlanDetail.seam?executionPlanUniqueId=_463760699&executionPlanId=35&equipmentID=EQDDD50&cid=32
so in this page also i have placed another refresh link, that will also work like reload the content of that table which is related to that perticular column datatable data.
Can you please give some example of component refresh extenally, while it is in conversation scope.
-
5. Re: How to Reload the conversation with the flushed data from data base using s:link
mkouba Sep 14, 2012 5:09 AM (in response to kishi_kiran)1 of 1 people found this helpfulMethod not found: com.logit.ui.execution.ExecutionPlanBean@1859ae.refresh()
If you don't implement the refresh method, it's not there and this error makes sense.
Data update is not propagated: this might be JPA and extended persistence context issue. For example if you use Seam managed persistence context within conversation the context is extended and lives even after the transaction completes. So if you execute the same query you get the results from the first level cache (aka Hibernate Session). You can try to call EntityManager.clear() in the getExecutionPlansForCompany() method right before the data are loaded. It's a kind of workaround but should work...
URL change - ok, it's expected behavior.
What I recommend you is to go through Seam 2 examples in download bundle.