I use this (for similar functionality), which is better because it is 
conversation scoped (app works in several windows):

On every page I can get "back" to, I store it in a conversation scoped 
component with a page action in pages.xml:


  |     <page view-id="/docDisplay.xhtml" action="#{documentBrowser.prepare()}">
  | 


  | @Name("documentBrowser")
  | public class DocumentBrowser {
  | 
  |     @In
  |     protected org.jboss.seam.core.Redirect redirect;
  | 
  |     public String prepare() {
  | 
  |                 // Store the view-id that called this method (as a page 
action) for return (exit of a later conversation)
  |                 redirect.captureCurrentRequest();
  |     }
  | 
  |     /**
  |      * Executes a redirect to the last view-id that was prepare()ed.
  |      * <p>
  |      * Usually called after ending a conversation. Assumes that the caller 
of the method does not want to propagate
  |      * the current (ended) conversation across that redirect. Also removes 
any stored <tt>actionOutcome</tt>,
  |      * <tt>actionMethod</tt> or <tt>cid</tt> request parameter before 
redirecting, we don't want to redirect to
  |      * a prepare()ed page that was in a long-running conversation 
(temporary doesn't matter) or that was last
  |      * called with an action (that action would probably send us straight 
back into the conversation we are trying
  |      * to redirect out of).
  |      */
  |     public void redirectToLastBrowsedPage() {
  | 
  |         // We don't want to redirect to an action, so if the last browsed 
page was called with an action, remove it
  |         redirect.getParameters().remove("actionOutcome");
  |         redirect.getParameters().remove("actionMethod");
  | 
  |         // If the last browsed page had a conversation identifier (we 
assume of a temporary conversation), remove it
  |         redirect.getParameters().remove("cid");
  | 
  |         // We also don't want to redirect the long-running conversation, 
the caller has ended it already
  |         redirect.setConversationPropagationEnabled(false);
  | 
  |         redirect.execute();
  |     }
  | 
  | }
  | 


And I can then later exit a conversation like this and redirect to the last 
"prepared" page:


  |     <s:button id="exit" value="Exit Editor" styleClass="button" 
action="#{documentBrowser.redirectToLastBrowsedPage()}"
  |               propagation="end"/>
  | 
  | 

There is some more details to this overall navigation strategy, but that should 
get you started.



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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4007023
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to