[jboss-user] [JBoss Seam] - Re: How to return to a previous page without conversations

christian.bauer@jboss.com do-not-reply at jboss.com
Fri Apr 6 13:24:48 EDT 2007


That sounds pretty much like the Seam Conversation scope, although much narrower and more focused on a particular use case. You can use the same examples and put it in Conversation scope - and then handle conversation propagation independently in your navigation rules. 

We have a quite complete model and the machinery for all of this already, what we need in Seam is the notion of entry points of conversations and the ability to return to that entry point at the end of a conversation or for a particular outcome during the conversation.

Right now there are several disjunct facilities in Seam for this (the Redirect component covers half of these cases, Conversation.redirect() can return you to the last view of the parent conversation from a nested conversation) that need to be unified, extended, and tied into the metadata.

So right now I do the polymorphic "exit a conversation correctly, no matter if it's nested or a root conversation" manually:


  |     public void exitConversation(Boolean endBeforeRedirect) {
  |         Conversation currentConversation = Conversation.instance();
  |         if (currentConversation.isNested()) {
  |             // End this nested conversation and return to last rendered view-id of parent
  |             currentConversation.endAndRedirect(endBeforeRedirect);
  |         } else {
  |             // Always end this conversation
  |             currentConversation.end();
  | 
  |             ConversationEntry entryPoint =
  |                     (ConversationEntry)Contexts.getConversationContext().get("conversationEntryPoint");
  |             if (entryPoint != null) {
  |                 // We came here from another conversation
  |                 if (entryPoint.isDisplayable()) {
  |                     entryPoint.switchConversation();
  |                 } else {
  |                     // The entry point is gone... What now? Go to start page...
  |                     Manager.instance().redirect("/display.xhtml", new HashMap<String,Object>(), true);
  |                 }
  |             } else {
  |                 // We came here from a non-conversational page
  |                 if (endBeforeRedirect)
  |                     redirectToLastBrowsedPage();
  |                 else
  |                     redirectToLastBrowsedPageWithConversation();
  |             }
  |         }
  |     }
  | 

I have to remember my entry points manually and return to them, see "conversationEntryPoint" and the mysterious redirectTo*() methods that do what I described earlier.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035408#4035408

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035408



More information about the jboss-user mailing list