-
1. Re: method defined in pages.xml can't start a converstaion
davidatkinsuk Jun 12, 2006 2:44 PM (in response to liudan2005)I think you want to try
<page view-id="/booking.xhtml" action="#{booking.start}">my conversation name</page>
The element value (which you used in your above fragment) is for providing the conversation name.
hope that works
dave -
2. Re: method defined in pages.xml can't start a converstaion
gavin.king Jun 12, 2006 3:52 PM (in response to liudan2005)Right.
-
3. Re: method defined in pages.xml can't start a converstaion
liudan2005 Jun 13, 2006 8:56 AM (in response to liudan2005)how do I define a conversation name in this case? I thought converstations are identified by IDs but not names. So I don't know what name I should specify here.
-
4. Re: method defined in pages.xml can't start a converstaion
theute Jun 13, 2006 10:18 AM (in response to liudan2005)You don't need to specify any if you don't use the workspace management. (Otherwise you can put any name)
In your case:<page view-id="/booking.xhtml" action="#{booking.start}"/>
is probably enough for what you want to achieve -
5. Re: method defined in pages.xml can't start a converstaion
liudan2005 Jun 13, 2006 11:14 AM (in response to liudan2005)I've tried it but it doesn't work. Here is what I get in console when trying to any method of booking class after page is displayed:
no long-running conversation for @Conversational bean: booking -
6. Re: method defined in pages.xml can't start a converstaion
davidatkinsuk Jun 13, 2006 2:14 PM (in response to liudan2005)I think this is because you have annoted your conversational bean as a nested conversation
@Begin(join=true)
try dropping the join = true@Begin
and it should work fine -
7. Re: method defined in pages.xml can't start a converstaion
liudan2005 Jun 13, 2006 4:28 PM (in response to liudan2005)Removing "join=true" doesn't help. I still get the same error. Here is my bean:
@Stateful @Name("booking") @Scope(CONVERSATION) @Interceptors(SeamInterceptor.class) @LoggedIn @Conversational(ifNotBegunOutcome = "home") public class BookingActionimplements Booking, Serializable { ... @Begin public String start() { em.refresh(user); return "booking"; } public String confirm() { ... return "confirmed"; } }
my pages.xml<page view-id="/booking.xhtml" action="#{booking.start}"/>
When user click confirm button in booking.seam page, the confirm is not called. Instead, the user gets redirected to home page because no conversation exists. -
8. Re: method defined in pages.xml can't start a converstaion
gavin.king Jun 15, 2006 3:37 AM (in response to liudan2005)Probably you are calling some other method of the bean before you call the start() method.
-
9. Re: method defined in pages.xml can't start a converstaion
gavin.king Jun 15, 2006 3:37 AM (in response to liudan2005)ie. try removing @Conversational
-
10. Re: method defined in pages.xml can't start a converstaion
liudan2005 Jun 15, 2006 6:00 AM (in response to liudan2005)I've simplified my code and tried everything i can but still no luck. Here is my code list in full
MyStuffAction.java@Stateful @Name("myStuff") @Scope(CONVERSATION) public class MyStuffAction implements MyStuff { @In(required=false,scope=ScopeType.CONVERSATION) @Out(required=false,scope=ScopeType.CONVERSATION) private String name; @Begin public String sayHello() { name="James"; System.out.println("Hello:"+name); return null; } public String sayBye(){ System.out.println("Bye:"+name); return "main"; } @Destroy @End @Remove public String end() { return null; } }
pages.xml<pages> <page view-id="/mypage.xhtml" action="#{myStuff.sayHello}" /> </pages>
mypage.xhtml<body id="pgHome"> <h:form> <div id="document"> <div id="container"> <div id="sidebar"> <h:commandButton action="#{myStuff.sayBye}" value="sayBye" /> </div> </div> </div> </h:form> </body>
Here is what I get from console(name is null when sayBye is invoked):
Hello:James
Bye:null
Is there anything I'm doing wrong?