To Gavin.King--how to start a conversation from pages.xml
ybxiang.wolf Oct 26, 2007 11:52 AMGavin.King:
I have a question for long, and i read seam_reference at least 3 times but still do not find the answer. Please help me.
The question is:
I have an home page with two links:
1)<s:link action="#{register.start}" value="Register" propagation="end"/>
2)<s:link action="#{userSearching.start}" value="Users Info" propagation="end"/>
When i push on them, old converstaion will stop[propagation="end"] and new CONVERSTAION-scoped conversation will start[XXX.start is annotated with @Begin].
Now, i finish registeration with register.uploadPicture[ annotaed with @End] and hope to start the converstaion of "userSearching" by executing #{userSearching.start}, but pages.xm does not support to do so!!! How shall i do?
<!-- registeration step1: set basic info -->
<page view-id="/pages/sys/user/register.xhtml">
<navigation from-action="#{register.register}">
<rule if-outcome="FAILURE">
<redirect view-id="/pages/sys/user/register.xhtml" />
<rule if-outcome="SUCCESS">
<redirect view-id="/pages/sys/user/setuserimg.xhtml" />
<!-- registeration step2: set user picture and end the conversation. -->
<page view-id="/pages/sys/user/setuserimg.xhtml">
<navigation from-action="#{register.uploadPicture}">
<!--
=========== ********************===========
I want to start userSearching conversation by executing "#{userSearching.start}" , but how???
=========== ********************===========
-->
Session-scoped userSearching is heavy, so i use conversation-scoped conversation. I hope pages.xml can be set to start the userSearching conversation indirectly rather than to jump to userSearching page[usersinfo.xhtml] directly.
NOTE:
I want to query and delete user in userSearching conversation , but do nothing more--that is why i use it as a conversation-scoped stateful session bean.
Now most things work perfect, but when i finish register user, jump to usersinfo.xhtml directly, and select one user to modify[ start other conversation:action="#{userModifying.selectObject(hot)}" ], NOW, this it will jump to debug.seam and tell me something wrong with conversation.
I DO NOT think you need to read below codes, but i show them to make things clearer.
********* register CONVERSATION************
@Stateful
@Name(value = "register")
@Scope(ScopeType.CONVERSATION)
public class RegisterAction implements RegisterItf {
.....................
@Factory("newUser")
@Begin
public void start() {
newUser = new User();
}
@Destroy
@Remove
public void destroy() {
}
public String register() {
if (this.checkCaptcha().equalsIgnoreCase("FAILURE")) {
return "FAILURE";
}else{
return "SUCCESS";
}
}
@End
public void uploadPicture() {
.............................
}
}//END OF CLASS
********* userSearching CONVERSATION ************
@Stateful
@Name("userSearching")
@Scope(ScopeType.CONVERSATION)
public class UserSearchingAction extends CommonSearchingAction implements UserSearchingItf {
@DataModel
private List queriedObjects;
@Begin
public void start() {
// initialize queriedObjects
}
@Destroy
@Remove
public void destroy() {
}
@DataModelSelection
@Out(required = false)
private User selectedObject;
public void delete() {
//delete user here
}
}
*********** usersinfo.xhtml begin******************
<rich:dataTable id="dataTable_queriedObjects"
value="#{queriedObjects}" var="hot"
rendered="#{queriedObjects.rowCount>0}">
<f:facet name="header">
<rich:columnGroup>
<h:column><h:outputText styleClass="headerText" value="username" /></h:column>
<h:column><h:outputText styleClass="headerText" value="Action" /></h:column>
</rich:columnGroup>
</f:facet>
<rich:columnGroup>
<h:column>#{hot.username}</h:column>
<h:column>
<s:button value="Delete" action="#{userSearching.delete}"/>
 
<s:button id="modifyObject" value="MOdify User" action="#{userModifying.selectObject(hot)}" propagation="end"/> </h:column>
</rich:columnGroup>
</rich:dataTable>
*********** usersinfo.xhtml end******************
Thanks and wait for your answer!
Best regards.