Try removing the redirect. You should see your facesMessage then.

Hope this helps. 

K

>  -------Original Message-------
>  From: Mick Knutson <[EMAIL PROTECTED]>
>  Subject: Re: Navigation from error question...
>  Sent: 14 Nov '06 17:01
>  
>  That did work, but now, I do not get the messages I want printed...
>  In registration.xhtml:
>  
>  <TD colspan="2">
>  <h:messages />
>  </TD>
>  
>  
>  <TD>
>  <h:inputText
>  value="#{UserBackingBean.user.username}"
>  required="true"
>  id="username" >
>  <f:validateLength minimum="2" />
>  </h:inputText>
>  <h:message for="username"
>  errorClass="error" />
>  </TD>
>  
>  
>  Then in my UserBackingBean:
>  
>  FacesContext.getCurrentInstance()
>  .addMessage(null,
>  new FacesMessage(
>  FacesMessage.SEVERITY_ERROR,
>  failureMessage,
>  failureMessage));
>  
>  //String failureMsg = ErrorMessages.getString
>  ("LoginBean.LOGIN_FAILURE");
>  FacesMessage message = new FacesMessage(
>  FacesMessage.SEVERITY_ERROR, failureMessage, failureMessage);
>  context.addMessage("login_form:loginButton", message);
>  
>  return (null);
>  
>  
>  But no messages are printed at all.
>  The page is displayed though...
>  
>  
>  On 11/13/06, GERALD MüLLAN  <[LINK: mailto:[EMAIL PROTECTED]
>  [EMAIL PROTECTED]> wrote: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 <[LINK: mailto:[EMAIL PROTECTED]
>  [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
>  >  [LINK: http://www.djmick.com] http://www.djmick.com
>  > [LINK: http://www.myspace.com/mickknutson]
>  http://www.myspace.com/mickknutson
>  
>  
>  --
>  [LINK: http://www.irian.at] http://www.irian.at
>  
>  Your JSF powerhouse -
>  JSF Consulting, Development and
>  Courses in English and German
>  
>  Professional Support for Apache MyFaces
>  
>  
>  --
>  
>  Thanks
>  
>  DJ MICK
>  [LINK: http://www.djmick.com] http://www.djmick.com
>  [LINK: http://www.myspace.com/mickknutson]
>  http://www.myspace.com/mickknutson

Reply via email to