Hi guys,
I actually need help from expert people.
I have a jsp page that shows a data table
| <f:view>
| <f:loadBundle basename="messages" var="msgs" />
| <h:form>
| <br>
| <t:dataTable id="cd" var="cd" preserveDataModel="false"
value="#{cdList}" width="100%" ......>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="titolo" />
| </f:facet>
| <h:outputText value="#{cd.titolo}" />
| </h:column>
| </t:dataTable>
| </h:form>
| </f:view>
|
and a session bean
| @Stateful
| @Name("TestManager")
| @Scope(ScopeType.SESSION)
| @Transactional
| public class TestManagerBean implements Serializable, TestManager
| {
| @PersistenceContext(type = PersistenceContextType.EXTENDED)
| private EntityManager em;
|
| @DataModel(value = "cdList")
| private List<Cd> cdList;
|
| public TestManagerBean()
| {
| }
|
| @Create
| public void create()
| {
| }
|
|
| @Factory("cdList")
| @Begin(join = true)
| public void findAll()
| {
| System.out.println("findAll");
|
| Query q = em.createQuery("select o from Cd o");
|
| cdList = q.getResultList();
| }
|
|
| @Remove
| @Destroy
| public void destroy()
| {
| }
|
| }
|
When the page is loaded the first time, the findAll function is called and the
page shows the data correctly.
When the page is refreshed the findAll is not called again and the page doesn't
show changes appened to the database.
So I decided to add the following function:
| public void onListLoad()
| {
|
| cdList = null;
|
| }
|
and I changed the pages.xml:
| <page view-id="/Test.jsp" action="#{TestManager.onListLoad}" />
|
Now refreshing the page the findAll function is recalled and all database
changes are shown.
The problem is that A NEW CONVERSATION is started at each refresh.
I have tried many options that do not work:
1) annotate the onListLoad function with @Begin(join=true)
2) modify pages.xml
| <page view-id="/Test.jsp" action="#{TestManager.onListLoad}" >
| <begin-conversation join="true"/>
| </page
|
3) add a remoting call to onListLoad directly from the page:
| function startup()
| {
| Seam.Remoting.getContext().setConversationId(conversationId);
| Seam.Component.getInstance("TestManager").onListLoad(startupCallback);
| }
|
| function startupCallback(operation)
| {
| alert(Seam.Remoting.getContext().getConversationId());
| }
|
| .....
|
| <body onload="startup()">
|
| ......
|
|
Can anyone give me the right solution ?
Thank you
Ragards
Fabrizio
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3998243#3998243
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3998243
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user