You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Kahlau <mk...@web.de> on 2006/01/01 22:08:40 UTC

h:messages outputs one error message summary many times

Hi all!


I have a problem with the h:messages tag. When an error occurs, e. g. an
validation error of f:validateLongRange, because the user entered an illegal
value (a value not contained in the range defined), the error summary is
printed many times in the h:messages tag. I use the tag the following way:

<h:messages layout="table" globalOnly="false" showSummary="true"
      showDetail="false" errorClass="error" fatalClass="error" />


When I explicitely add an error message for a specific component to the
FacesContext, I haven't observed that behaviour - the error message is
printed only one time.


Regards,

Matthias


Re: AW: messages outputs one error message summary many times

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi,

i also haven't seen that behavior anytime.



Matthias,
  can you again post a bit more of your code?

  jsf context of the component where the multiple message is for, and
  action code of the submit button.

  the posted code of h:messages simply says: all messages going here.
  the problem must be otherwere.

Regards,
  Volker

Martin Marinschek wrote:
> Phase-listeners shouldn't have to do anything with this.
> 
> I don't recall to have seen that behaviour with messages in any case.
> 
> Can you try out the MyFaces examples and see if you can reproduce the
> problem there, eventually with a slight change to one of the examples?
> If yes, open a jira issue and tell us your steps to reproduce the
> issue.
> 
> regards,
> 
> Martin
> 
> On 1/3/06, Rick Gruber-Riemer <ri...@vanosten.net> wrote:
> 
>>I think to remember that you have to look out for phaselisteners, which
>>might be registered two times ...
>>Matthias Kahlau wrote:
>>
>>>Hi!
>>>
>>>Did anybody else discover the behaviour of h:messages described below? I
>>>can't imagine that I've done sth. wrong, but please correct me if I'm wrong.
>>>There's only one h:messages tag in my JSF page, and when one error occurs,
>>>the same error message is printed multiple times (2 to x times). Is there a
>>>way to prevent this?
>>>
>>>
>>>Regards,
>>>
>>>Matthias
>>>
>>>
>>>
>>>>-----Ursprüngliche Nachricht-----
>>>>Von: users-return-14489-mkahlau=web.de@myfaces.apache.org
>>>>[mailto:users-return-14489-mkahlau=web.de@myfaces.apache.org]Im Auftrag
>>>>von Matthias Kahlau
>>>>Gesendet: Sonntag, 1. Januar 2006 22:09
>>>>An: Users MyFaces
>>>>Betreff: h:messages outputs one error message summary many times
>>>>
>>>>
>>>>Hi all!
>>>>
>>>>
>>>>I have a problem with the h:messages tag. When an error occurs, e. g. an
>>>>validation error of f:validateLongRange, because the user entered
>>>>an illegal
>>>>value (a value not contained in the range defined), the error summary is
>>>>printed many times in the h:messages tag. I use the tag the following way:
>>>>
>>>><h:messages layout="table" globalOnly="false" showSummary="true"
>>>>      showDetail="false" errorClass="error" fatalClass="error" />
>>>>
>>>>
>>>>When I explicitely add an error message for a specific component to the
>>>>FacesContext, I haven't observed that behaviour - the error message is
>>>>printed only one time.
>>>>
>>>>
>>>>Regards,
>>>>
>>>>Matthias
>>>>
>>>>
>>>
>>>
>>>
>>
> 
> 
> --
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Re: AW: messages outputs one error message summary many times

Posted by Martin Marinschek <ma...@gmail.com>.
Phase-listeners shouldn't have to do anything with this.

I don't recall to have seen that behaviour with messages in any case.

Can you try out the MyFaces examples and see if you can reproduce the
problem there, eventually with a slight change to one of the examples?
If yes, open a jira issue and tell us your steps to reproduce the
issue.

regards,

Martin

On 1/3/06, Rick Gruber-Riemer <ri...@vanosten.net> wrote:
> I think to remember that you have to look out for phaselisteners, which
> might be registered two times ...
> Matthias Kahlau wrote:
> > Hi!
> >
> > Did anybody else discover the behaviour of h:messages described below? I
> > can't imagine that I've done sth. wrong, but please correct me if I'm wrong.
> > There's only one h:messages tag in my JSF page, and when one error occurs,
> > the same error message is printed multiple times (2 to x times). Is there a
> > way to prevent this?
> >
> >
> > Regards,
> >
> > Matthias
> >
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: users-return-14489-mkahlau=web.de@myfaces.apache.org
> >> [mailto:users-return-14489-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> >> von Matthias Kahlau
> >> Gesendet: Sonntag, 1. Januar 2006 22:09
> >> An: Users MyFaces
> >> Betreff: h:messages outputs one error message summary many times
> >>
> >>
> >> Hi all!
> >>
> >>
> >> I have a problem with the h:messages tag. When an error occurs, e. g. an
> >> validation error of f:validateLongRange, because the user entered
> >> an illegal
> >> value (a value not contained in the range defined), the error summary is
> >> printed many times in the h:messages tag. I use the tag the following way:
> >>
> >> <h:messages layout="table" globalOnly="false" showSummary="true"
> >>       showDetail="false" errorClass="error" fatalClass="error" />
> >>
> >>
> >> When I explicitely add an error message for a specific component to the
> >> FacesContext, I haven't observed that behaviour - the error message is
> >> printed only one time.
> >>
> >>
> >> Regards,
> >>
> >> Matthias
> >>
> >>
> >
> >
> >
>
>


--

http://www.irian.at

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

Professional Support for Apache MyFaces

Re: AW: messages outputs one error message summary many times

Posted by Rick Gruber-Riemer <ri...@vanosten.net>.
I think to remember that you have to look out for phaselisteners, which 
might be registered two times ...
Matthias Kahlau wrote:
> Hi!
>
> Did anybody else discover the behaviour of h:messages described below? I
> can't imagine that I've done sth. wrong, but please correct me if I'm wrong.
> There's only one h:messages tag in my JSF page, and when one error occurs,
> the same error message is printed multiple times (2 to x times). Is there a
> way to prevent this?
>
>
> Regards,
>
> Matthias
>
>   
>> -----Ursprüngliche Nachricht-----
>> Von: users-return-14489-mkahlau=web.de@myfaces.apache.org
>> [mailto:users-return-14489-mkahlau=web.de@myfaces.apache.org]Im Auftrag
>> von Matthias Kahlau
>> Gesendet: Sonntag, 1. Januar 2006 22:09
>> An: Users MyFaces
>> Betreff: h:messages outputs one error message summary many times
>>
>>
>> Hi all!
>>
>>
>> I have a problem with the h:messages tag. When an error occurs, e. g. an
>> validation error of f:validateLongRange, because the user entered
>> an illegal
>> value (a value not contained in the range defined), the error summary is
>> printed many times in the h:messages tag. I use the tag the following way:
>>
>> <h:messages layout="table" globalOnly="false" showSummary="true"
>>       showDetail="false" errorClass="error" fatalClass="error" />
>>
>>
>> When I explicitely add an error message for a specific component to the
>> FacesContext, I haven't observed that behaviour - the error message is
>> printed only one time.
>>
>>
>> Regards,
>>
>> Matthias
>>
>>     
>
>
>   


Re: AW: messages outputs one error message summary many times

Posted by Travis Reeder <tr...@gmail.com>.
I asked a similar question a few weeks ago and it turns out that if no
"detail" message is set, it uses the summary message (this is in the spec
for some reason), so you get the exact same message printed twice if you
have showDetail="true", so you may want to double check that.

Travis

On 1/3/06, Simon Kitching <sk...@obsidium.com> wrote:
>
> Hi Matthias,
>
> A FacesMessage object has both a "summary" and "detail". Perhaps both
> are being set to the same string and you are showing both, resulting in
> the same message appearing twice?
>
> Regards,
>
> Simon
>
> Matthias Kahlau wrote:
> > Hi!
> >
> > Did anybody else discover the behaviour of h:messages described below? I
> > can't imagine that I've done sth. wrong, but please correct me if I'm
> wrong.
> > There's only one h:messages tag in my JSF page, and when one error
> occurs,
> > the same error message is printed multiple times (2 to x times). Is
> there a
> > way to prevent this?
> >
> >
> > Regards,
> >
> > Matthias
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: users-return-14489-mkahlau=web.de@myfaces.apache.org
> >> [mailto:users-return-14489-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> >> von Matthias Kahlau
> >> Gesendet: Sonntag, 1. Januar 2006 22:09
> >> An: Users MyFaces
> >> Betreff: h:messages outputs one error message summary many times
> >>
> >>
> >> Hi all!
> >>
> >>
> >> I have a problem with the h:messages tag. When an error occurs, e. g.
> an
> >> validation error of f:validateLongRange, because the user entered
> >> an illegal
> >> value (a value not contained in the range defined), the error summary
> is
> >> printed many times in the h:messages tag. I use the tag the following
> way:
> >>
> >> <h:messages layout="table" globalOnly="false" showSummary="true"
> >>       showDetail="false" errorClass="error" fatalClass="error" />
> >>
> >>
> >> When I explicitely add an error message for a specific component to the
> >> FacesContext, I haven't observed that behaviour - the error message is
> >> printed only one time.
> >>
> >>
> >> Regards,
> >>
> >> Matthias
> >>
> >
> >
> >
>
>

AW: AW: messages outputs one error message summary many times

Posted by Matthias Kahlau <mk...@web.de>.
Hi!

I checked it again, and that's my h:messages tag I use in the JSF page where
the problem occurs:


<h:messages layout="table" globalOnly="false" showSummary="true"
      showDetail="false" errorClass="error" fatalClass="error" />


I could reproduce the error ('Validierungsfehler' printed twice) with the
following scenario:

I entered the number '0' in the following inputText, which has a
f:validateLongRange child element:
(it also happens if I enter other illegal values like '-1')


<t:column>
          <t:checkbox for="Antwortanzahl" index="0" />
          <t:inputText id="min_Antwortanzahl"
            binding="#{MehrfAuswFrageBacking.inputTextAnzahlAntwortenMin}"
            value="#{MehrfAuswFrageBacking.mehrfAuswFrage.minanzahl}"
            required="false"
            readonly="false"
            disabled="false"
            maxlength="2"
            size="2"
            title="Textfeld zur Eingabe der min. Antwortanzahl"
            immediate="false">
            <f:validateLongRange minimum="1" maximum="99" />
          </t:inputText>
          <h:outputText escape="false"
            value="&nbsp;(1 bis 99)"
            styleClass="formText"
            lang="de"
            title="Zahlenbereich ist 1 bis 99" />
          <f:verbatim><br/></f:verbatim>
          <h:message for="min_Antwortanzahl"
            styleClass="error"
            lang="de"
            title="Fehlermeldung für das Textfeld zur Eingabe der min.
              Antwortanzahl" />
 </t:column>



This is the commandButton for submitting the page (immediate="false"):
---------------------------------------------------------------------

<h:commandButton value="Speichern"
          action="#{MehrfAuswFrageBacking.save}"
          styleClass="button"
          lang="de"
          title="Speichern und zurück zum Fragen Formular"
          immediate="false" />




Regards,

Matthias

> -----Ursprüngliche Nachricht-----
> Von: users-return-14590-mkahlau=web.de@myfaces.apache.org
> [mailto:users-return-14590-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> von Simon Kitching
> Gesendet: Dienstag, 3. Januar 2006 22:20
> An: MyFaces Discussion
> Betreff: Re: AW: messages outputs one error message summary many times
>
>
> Hi Matthias,
>
> A FacesMessage object has both a "summary" and "detail". Perhaps both
> are being set to the same string and you are showing both, resulting in
> the same message appearing twice?
>
> Regards,
>
> Simon
>
> Matthias Kahlau wrote:
> > Hi!
> >
> > Did anybody else discover the behaviour of h:messages described below? I
> > can't imagine that I've done sth. wrong, but please correct me
> if I'm wrong.
> > There's only one h:messages tag in my JSF page, and when one
> error occurs,
> > the same error message is printed multiple times (2 to x
> times). Is there a
> > way to prevent this?
> >
> >
> > Regards,
> >
> > Matthias
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: users-return-14489-mkahlau=web.de@myfaces.apache.org
> >> [mailto:users-return-14489-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> >> von Matthias Kahlau
> >> Gesendet: Sonntag, 1. Januar 2006 22:09
> >> An: Users MyFaces
> >> Betreff: h:messages outputs one error message summary many times
> >>
> >>
> >> Hi all!
> >>
> >>
> >> I have a problem with the h:messages tag. When an error
> occurs, e. g. an
> >> validation error of f:validateLongRange, because the user entered
> >> an illegal
> >> value (a value not contained in the range defined), the error
> summary is
> >> printed many times in the h:messages tag. I use the tag the
> following way:
> >>
> >> <h:messages layout="table" globalOnly="false" showSummary="true"
> >>       showDetail="false" errorClass="error" fatalClass="error" />
> >>
> >>
> >> When I explicitely add an error message for a specific component to the
> >> FacesContext, I haven't observed that behaviour - the error message is
> >> printed only one time.
> >>
> >>
> >> Regards,
> >>
> >> Matthias
> >>
> >
> >
> >
>


Re: AW: messages outputs one error message summary many times

Posted by Simon Kitching <sk...@obsidium.com>.
Hi Matthias,

A FacesMessage object has both a "summary" and "detail". Perhaps both 
are being set to the same string and you are showing both, resulting in 
the same message appearing twice?

Regards,

Simon

Matthias Kahlau wrote:
> Hi!
> 
> Did anybody else discover the behaviour of h:messages described below? I
> can't imagine that I've done sth. wrong, but please correct me if I'm wrong.
> There's only one h:messages tag in my JSF page, and when one error occurs,
> the same error message is printed multiple times (2 to x times). Is there a
> way to prevent this?
> 
> 
> Regards,
> 
> Matthias
> 
>> -----Ursprüngliche Nachricht-----
>> Von: users-return-14489-mkahlau=web.de@myfaces.apache.org
>> [mailto:users-return-14489-mkahlau=web.de@myfaces.apache.org]Im Auftrag
>> von Matthias Kahlau
>> Gesendet: Sonntag, 1. Januar 2006 22:09
>> An: Users MyFaces
>> Betreff: h:messages outputs one error message summary many times
>>
>>
>> Hi all!
>>
>>
>> I have a problem with the h:messages tag. When an error occurs, e. g. an
>> validation error of f:validateLongRange, because the user entered
>> an illegal
>> value (a value not contained in the range defined), the error summary is
>> printed many times in the h:messages tag. I use the tag the following way:
>>
>> <h:messages layout="table" globalOnly="false" showSummary="true"
>>       showDetail="false" errorClass="error" fatalClass="error" />
>>
>>
>> When I explicitely add an error message for a specific component to the
>> FacesContext, I haven't observed that behaviour - the error message is
>> printed only one time.
>>
>>
>> Regards,
>>
>> Matthias
>>
> 
> 
> 


AW: messages outputs one error message summary many times

Posted by Matthias Kahlau <mk...@web.de>.
Hi!

Did anybody else discover the behaviour of h:messages described below? I
can't imagine that I've done sth. wrong, but please correct me if I'm wrong.
There's only one h:messages tag in my JSF page, and when one error occurs,
the same error message is printed multiple times (2 to x times). Is there a
way to prevent this?


Regards,

Matthias

> -----Ursprüngliche Nachricht-----
> Von: users-return-14489-mkahlau=web.de@myfaces.apache.org
> [mailto:users-return-14489-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> von Matthias Kahlau
> Gesendet: Sonntag, 1. Januar 2006 22:09
> An: Users MyFaces
> Betreff: h:messages outputs one error message summary many times
>
>
> Hi all!
>
>
> I have a problem with the h:messages tag. When an error occurs, e. g. an
> validation error of f:validateLongRange, because the user entered
> an illegal
> value (a value not contained in the range defined), the error summary is
> printed many times in the h:messages tag. I use the tag the following way:
>
> <h:messages layout="table" globalOnly="false" showSummary="true"
>       showDetail="false" errorClass="error" fatalClass="error" />
>
>
> When I explicitely add an error message for a specific component to the
> FacesContext, I haven't observed that behaviour - the error message is
> printed only one time.
>
>
> Regards,
>
> Matthias
>