You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Virtudazo, Dennis (Exchange)" <dv...@bear.com> on 2006/02/09 16:22:01 UTC

Adding a message to the context for a clientId is not working. I saw in
the wiki page that the example matches my code. Can somebody give me a
hint what may be wrong?

Jsp:
<h:inputText id="refreshminutes"  binding="#{backingBean.myComponent}"
size="5" value="#{backingBean.refreshMinutes}" />
<h:message for="refreshminutes" showDetail="true"/>


Code:
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(myComponent.getClientId(context), new
FacesMessage("test", "test"));


The test message never displays. But error messages from the validator
do, for example, when I enter a non-numeric value into the
refreshMinutes inputText.

Btw, if I use <h:messages globalOnly="false", then the test message
displays.

I tried version 1.09-m9 and 1.1.1.


***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation, 
offer or agreement or any information about any transaction, customer 
account or account activity contained in this communication.
***********************************************************************


Re: Posted by Hans Sowa <ha...@gmail.com>.
Hm,

This code should work it looks my code except one but I think this should
not be the problem but maybe:
FacesMessage errMsg = new FacesMessage(
                FacesMessage.SEVERITY_INFO,
                shortMsg,
                longMsg);
I used an other Constructor. Maybe there is a problem with missing Severtiy.

best regards Hans




2006/2/9, Andrew Robinson <an...@gmail.com>:
>
> Are you using subviews or tiles perhaps? Before I switched to facelets I
> saw many problems like this where components fell out of "local scope" and
> the message tag could not locate a component due to the view/subview
> structure of a page.
>
> On 2/9/06, Virtudazo, Dennis (Exchange) <dv...@bear.com> wrote:
> >
> > Adding a message to the context for a clientId is not working. I saw in
> > the wiki page that the example matches my code. Can somebody give me a
> > hint what may be wrong?
> >
> > Jsp:
> > <h:inputText id="refreshminutes"  binding="#{ backingBean.myComponent}"
> > size="5" value="#{backingBean.refreshMinutes}" />
> > <h:message for="refreshminutes" showDetail="true"/>
> >
> >
> > Code:
> > FacesContext context = FacesContext.getCurrentInstance();
> > context.addMessage(myComponent.getClientId(context), new
> > FacesMessage("test", "test"));
> >
> >
> > The test message never displays. But error messages from the validator
> > do, for example, when I enter a non-numeric value into the
> > refreshMinutes inputText.
> >
> > Btw, if I use <h:messages globalOnly="false", then the test message
> > displays.
> >
> > I tried version 1.09-m9 and 1.1.1.
> >
> >
> > ***********************************************************************
> > Bear Stearns is not responsible for any recommendation, solicitation,
> > offer or agreement or any information about any transaction, customer
> > account or account activity contained in this communication.
> > ***********************************************************************
> >
> >
>


--
mfg Hans Sowa
mailto:hanssowa@gmail.com

Re: Posted by Andrew Robinson <an...@gmail.com>.
Are you using subviews or tiles perhaps? Before I switched to facelets I saw
many problems like this where components fell out of "local scope" and the
message tag could not locate a component due to the view/subview structure
of a page.

On 2/9/06, Virtudazo, Dennis (Exchange) <dv...@bear.com> wrote:
>
> Adding a message to the context for a clientId is not working. I saw in
> the wiki page that the example matches my code. Can somebody give me a
> hint what may be wrong?
>
> Jsp:
> <h:inputText id="refreshminutes"  binding="#{backingBean.myComponent}"
> size="5" value="#{backingBean.refreshMinutes}" />
> <h:message for="refreshminutes" showDetail="true"/>
>
>
> Code:
> FacesContext context = FacesContext.getCurrentInstance();
> context.addMessage(myComponent.getClientId(context), new
> FacesMessage("test", "test"));
>
>
> The test message never displays. But error messages from the validator
> do, for example, when I enter a non-numeric value into the
> refreshMinutes inputText.
>
> Btw, if I use <h:messages globalOnly="false", then the test message
> displays.
>
> I tried version 1.09-m9 and 1.1.1.
>
>
> ***********************************************************************
> Bear Stearns is not responsible for any recommendation, solicitation,
> offer or agreement or any information about any transaction, customer
> account or account activity contained in this communication.
> ***********************************************************************
>
>