[jboss-user] [JBoss Seam] - captureCurrentView

monkeyden do-not-reply at jboss.com
Thu Jun 14 12:40:36 EDT 2007


Having some trouble with captureCurrentView().  

The use case is:
Actor is on any page within the application.  Let's call it "Page A".
Actor clicks the "Sign Up" link
Actor is presented with the "Sign Up" page
Actor enters necessary info and selects "Submit"
Actor is brought to the "Sign Up Confirm" page, which displays a "Continue" button
Actor selects the continue button and is brought back to Page A.

I have an RegisterAction:

@Name("registerAction")
  | @Scope(CONVERSATION)
  | public class RegisterAction{
  |     @Begin
  |     public String begin(){
  |         redirect.captureCurrentView();
  |         return "signupPage";
  |     }
  | 
  |     public String register() {
  |         //create records
  |         ....
  | 
  |         //explicitly log the user in
  |         identity.setUsername(user.getUserName());
  |         identity.setPassword(user.getUserPassword());
  |         loginAction.login();
  |         result = "confirm";
  |     }
  |     
  |     @Create
  |     public void create(){
  | 
  |     }
  | 
  |     @End
  |     public String takeMeBack(){
  |         redirect.returnToCapturedView();
  |         return null;
  |     }
  | }


I have a commandLInk which points to begin()
<ice:commandLink id="signUpLink" value="#{messages['personalizationBar.label.signUp']}" action="#{registerAction.begin}"></ice:commandLink>

And I have a commandButton on the Confirm page, which points to takeMeBack()

<ice:commandButton id="continueButton"
  | image="images/btn_continue.gif" 
  | onmouseover="javascript:this.src='images/btn_continue_hover.gif'"
  |                           onmouseout="javascript:this.src='images/btn_continue.gif'"    
  | 
  | action="#{registerAction.takeMeBack}"/>
  | 


I also have navigation rules in pages.xml

<page view-id="/userMaintenance/signup.xhtml">
  |         <navigation from-action="#{registerAction.register}">
  |             <rule if-outcome="confirm">
  |                 <redirect view-id="/userMaintenance/signupConfirm.xhtml" />
  |             </rule>
  |             <rule if-outcome="failure">
  |                 <redirect view-id="/userMaintenance/signup.xhtml" />
  |             </rule>
  |         </navigation>
  |     </page>
  | 

The problem is, it appears that Seam is redirecting to the captured view after the register() method, when I return "confirm", rather than when the "Continue" button calls takeMeBack().  I wouldn't expect Seam to do the redirect automatically ever, but if it did, I wouldn't expect it to happen until after @End is encountered.  

Any clues?  Am I misunderstanding how captureCurrentView works?

Thanks

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

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



More information about the jboss-user mailing list