You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rudi Steiner <ru...@googlemail.com> on 2007/05/08 16:41:56 UTC

Message rendered twice

Hello,

I'm implementing a wizard-like sequence of pages. The problem is, that
the user dosn't have to fill out the pages sequentialy and can save
the entered information at every point in time and restart to fill in
the forms in another session.

The problem I have is, that I have to validate some constraints before
saving. So for example, when the user clicks on save on page 3, I have
to check if he has entered one field on page 1. To do this, I
implemented the method public String saveTemp() in my backingBean, as
an action for my commandButton.

In this method I do the following:

public String saveTemp(){
		
        //selectedBid is bound to a inputText on Page 1
	if(selectedBid == null || selectedBid.trim().equals("")){
			
			FacesContext context = FacesContext.getCurrentInstance();
			FacesMessage message = new FacesMessage("Please select a bid on page 1");
			
			context.addMessage(null, message);
                        //context.addMessage("", message);
			return null;
		}
   //continue to save the information entered
}

Everything works fine so far and the message is shown on the page the
user is coming from but the message is shown two times: Please select
a bid on page 1 Please select a bid on page 1

Has anybody an idea?

Thank you in advance,
Rudi