Hi,

in order to stay on the same page, you can also return null. You don`t
need any special navigation outcome to achieve this.

cheers,

Gerald

On 11/13/06, Mick Knutson <[EMAIL PROTECTED]> wrote:
I am fairly new to JSF, but thought that I had this right, however I am not
getting the navigation I expect...

When I get an error for a duplicate username, I want to be sent back to my
registration form and have an error message shows.

faces-config:
============

    <navigation-rule>

<from-view-id>/views/registration.xhtml</from-view-id>
        <navigation-case>
             <from-outcome>success</from-outcome>

<to-view-id>/views/secure/index.xhtml</to-view-id>
             <redirect/>
         </navigation-case>
         <navigation-case>
             <from-outcome>cancel</from-outcome>
             <to-view-id>/views/center.xhtml</to-view-id>
             <redirect/>
         </navigation-case>
         <navigation-case>
            <from-outcome>duplicateUsername</from-outcome>

<to-view-id>/views/registration.xhtml</to-view-id>
            <redirect/>
         </navigation-case>
    </navigation-rule>





Here is the UserBackingBean method:
============================

    public String createUser(){
        log.info("createUser()");

        FacesContext context = FacesContext.getCurrentInstance();

        try{
            userManager.createUser(getUser());
        } catch(Exception e){
            log.error("Duplicate user name. Username already exists");
            e.printStackTrace();
            String failureMessage = "Duplicate user name. Username already
exists";
            FacesContext.getCurrentInstance()
                    .addMessage(null,
                            new FacesMessage(

FacesMessage.SEVERITY_ERROR,
                                    failureMessage,
                                    failureMessage));

            return "duplicateUsername";
        }
        return "success";
    }


When I get this error, I still get sent to /views/secure/index.xhtml, same
as if I succeeded...


--

Thanks

DJ MICK
http://www.djmick.com
http://www.myspace.com/mickknutson


--
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to