You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Alin Dosoniu <ad...@hotmail.com> on 2005/07/19 17:02:32 UTC
delete a message from FacesContext messages list
Hello,
Is there a possibility to access the list of messages from FacesContext and to remove an item from it? I had a look at the sources and did not see one.
I have a page with an inputText control and it has a validator. The scenario that I wish to implement is like this:
- user goes on the page, introduce a value in inputText control and press Ok.
- on the server the validator method checks the value and it is not ok, so return the user the same page with the error message displayed. Until now, everything is ok.
- I want to offer the user the possibility to remain on the same page but to not display the message. Suppose there is a button on the same page that goes the user to the same page but with another state of the page (before it was New, now it is Search). For this, I will need a method to remove the error messages added by validator(s).
I tried to call FacesContext.release() (which sets the _messages on null), but run in a NullPointerException in LifecycleImpl.render method.
Is there another way to achieve the same behaviour?
Thanks in advance,
Alin.
Re: delete a message from FacesContext messages list
Posted by Alin Dosoniu <ad...@hotmail.com>.
Yes, it works! I forgot about immediate :( ..
Thank you,
Alin.
I don't know if I understand you correctly. But, could be useful to
you to use the 'immediate' attribute in your button?
Bruno
2005/7/19, Alin Dosoniu <ad...@hotmail.com>:
>
> Hello,
>
> Is there a possibility to access the list of messages from FacesContext
> and
> to remove an item from it? I had a look at the sources and did not see
> one.
>
> I have a page with an inputText control and it has a validator. The
> scenario
> that I wish to implement is like this:
> - user goes on the page, introduce a value in inputText control and press
> Ok.
> - on the server the validator method checks the value and it is not ok, so
> return the user the same page with the error message displayed. Until now,
> everything is ok.
> - I want to offer the user the possibility to remain on the same page but
> to
> not display the message. Suppose there is a button on the same page that
> goes the user to the same page but with another state of the page (before
> it
> was New, now it is Search). For this, I will need a method to remove the
> error messages added by validator(s).
>
> I tried to call FacesContext.release() (which sets the _messages on null),
> but run in a NullPointerException in LifecycleImpl.render method.
>
> Is there another way to achieve the same behaviour?
>
> Thanks in advance,
> Alin.
Re: delete a message from FacesContext messages list
Posted by Bruno Aranda <br...@gmail.com>.
I don't know if I understand you correctly. But, could be useful to
you to use the 'immediate' attribute in your button?
Bruno
2005/7/19, Alin Dosoniu <ad...@hotmail.com>:
>
> Hello,
>
> Is there a possibility to access the list of messages from FacesContext and
> to remove an item from it? I had a look at the sources and did not see one.
>
> I have a page with an inputText control and it has a validator. The scenario
> that I wish to implement is like this:
> - user goes on the page, introduce a value in inputText control and press
> Ok.
> - on the server the validator method checks the value and it is not ok, so
> return the user the same page with the error message displayed. Until now,
> everything is ok.
> - I want to offer the user the possibility to remain on the same page but to
> not display the message. Suppose there is a button on the same page that
> goes the user to the same page but with another state of the page (before it
> was New, now it is Search). For this, I will need a method to remove the
> error messages added by validator(s).
>
> I tried to call FacesContext.release() (which sets the _messages on null),
> but run in a NullPointerException in LifecycleImpl.render method.
>
> Is there another way to achieve the same behaviour?
>
> Thanks in advance,
> Alin.