1 Reply Latest reply on Sep 19, 2007 11:19 PM by Joshua Jackson

    DVD Store sample - returns "success".

    Gerson M Newbie

      I'm trying to understand the 'DVD Store' sample that comes with seam distribution. The EditCustomerAction.saveUser() could return the "success" string, but I can't find its reference in the pages.xml. How does Seam know which page it should forward to?

       public String saveUser() {
       if (!isValidNamePassword()) {
       facesMessages.add("User name #{customer.userName} is not unique");
       return null;
       }
      
       try {
       em.persist(customer);
       sessionContext.set("currentUser", customer);
       Actor.instance().setId(customer.getUserName());
      
       identity.setUsername(customer.getUserName());
       identity.setPassword(customer.getPassword());
       identity.login();
      
       facesMessages.addFromResourceBundle("createCustomerSuccess");
       return "success";
       } catch (InvalidStateException e) {
       InvalidValue[] vals = e.getInvalidValues();
       for (InvalidValue val: vals) {
       facesMessages.add(val);
       }
      
       return null;
       } catch (RuntimeException e) {
       ctx.setRollbackOnly();
      
       facesMessages.addFromResourceBundle("createCustomerError");
      
       return null;
       }
       }