[jboss-user] [JBoss Seam] - How to end converstation when user doesn't cooperate?

tynor do-not-reply at jboss.com
Sat Aug 25 16:23:30 EDT 2007


Seam 1.2.1-GA, seam-gen derived infrastructure (Home classes, etc.)

My recent discovery of the need to use MANUAL flushing on a certain page has gotten me to pay more attention to conversational lifespan than I had in earlier phases of our app's development.  I am now worried about the following use case / bug which I can easily produce in my app (NOTE: this is on a page that is not using MANUAL flushing - it's orthogonal to the flush-mode):

 User selects "Edit Widget" which instantiates a new instance of WidgetHome and loads Widget #1 into its getInstance().  page.xml for this page sets up the conversation: 

 <begin-conversation join="true"/>

 As long as the user ends his interaction with the form in one of the "expected" ways (Save, Remove, Cancel), he will trigger a corresponding <end-conversation> specified either in the navigation rules in page.xml, or via a propagation="end" in the xhtml.

However: what happens if the user exits the form by some other means (e.g. a link off the global menu.xhtml, a bookmarked link, etc.).   The conversation will not end.  Let's say that menu link gets him back to the page where he can click "Create Widget".   Normally, this would create a new WidgetHome and a brand spanking fresh createInstance() call would create a new Widget instance.  But since I'm still in the old conversation, I end up reusing the old WidgetHome from the "improperly" exited form page -- and my "Create Widget" screen is populated with the Widget #1 I was visiting before I so rudely left the page with a Menu link instead of a Cancel. 

I can't find any provision in the Seam navigation model for blanket ending a conversation.  For the global navigation menu, perhaps I could add propogate="end" to all the s:link's (I'd have to think that through - I'm not sure I'd _always_ want to do that).  but that doesn't help with other cases (a bookmarked link, the user typing a URL into the address bar, etc.).

The only think I can think of is to create some sort of AJAX-y event that I can call from an onunload Javascript event to end the conversation no matter why the user is navigating away from the page.  This feels dirty.  It can't be how Seam intends conversations to work... 

Help?


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

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



More information about the jboss-user mailing list