myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Heidrich <Andreas.Heidr...@toyota-fs.com>
Subject Antwort: Re: Messages on JSF Site are shown twice
Date Thu, 04 Oct 2007 09:44:04 GMT

Thanx for the hint Simon. At least I did it exactly this way. Although I
find the default below a bit odd as it leeds to the error I had.

Regards
Andreas
                                                        
                                                        
                                                        
 Andreas Heidrich                         (Embedded     
 Organisationsprogrammierer/EDV Orga      image moved   
 Toyota Kreditbank GmbH                   to file:      
 Tel: +49-2234-102-1963|Fax:              pic22483.gif) 
 +49-2234-102-99-1963                                   
 Email: andreas.heidrich@toyota-fs.com                  
                                                        




                                                                           
             Simon Kitching                                                
             <simon.kitching@c                                             
             hello.at>                                                  An 
                                        MyFaces Discussion                 
             02.10.2007 17:11           <users@myfaces.apache.org>         
                                                                     Kopie 
                                        Angel Miralles Arevalo             
              Bitte antworten           <anmiralles@yahoo.es>              
                    an                                               Thema 
                 "MyFaces               Re: Messages on JSF Site are shown 
                Discussion"             twice                              
             <users@myfaces.ap                                             
                 ache.org>                                                 
                                                                           
                                                                           
                                                                           
                                                                           




Yep, the problem is that your t:messages has

  showDetail=true.

but your FacesMessage object has no detail set.

If you ask for the detail to be rendered, but the FacesMessage object has
null as its detail string, then it uses the summary string. Here's the
relevant method from the FacesMessage class:

   public String getDetail()
    {
        if (_detail == null)
        {
            return _summary;
        }
        return _detail;
    }

It looks to me like the MessageUtils class looks in the bundle for a
special entry of form ${key}_detail. So in your case, defining a resource
named "zipCodeNotValid_detail" would also solve the problem (by giving you
proper separate summary and detail strings).

Regards,

Simon


---- Angel Miralles Arevalo <anmiralles@yahoo.es> schrieb:
> Try with this:

jsp code:

<h:messages globalOnly="true" showDetail="true" showSummary="false"
styleClass="hcenter mensaje_alerta" />

Bean code:

// Add message in case of error
ResourceBundle resource =
ResourceBundle.getBundle("servidesk.messages.MessageResources");
FacesMessage message = MessageUtils.getMessage(resource,
"info.ko.grabar.grupo", null);
getFacesContext().addMessage(null, message);

Note than I read from a properties file:
"servidesk.messages.MessageResources"


----- Mensaje original ----
De: Andreas Heidrich <Andreas.Heidrich@toyota-fs.com>
Para: MyFaces Discussion <users@myfaces.apache.org>
Enviado: martes, 2 de octubre, 2007 11:43:51
Asunto: Messages on JSF Site are shown twice


Hello,
we are working on our first JSF Implementation at the moment. So forgive me
if this is a stupid question ;-)

We show all error messages in a single area on the page like this:

            <t:div styleClass="errors"
                  rendered="#{customerWebController.notValid}">
                  <f:verbatim>
                        <h5>Folgende Fehler sind aufgetreten:</h5>
                  </f:verbatim>
                  <t:messages showDetail="true" />
            </t:div>

In the code, we add some messages with the FacesContext addMessage
mechanism like this:

                        FacesContext.getCurrentInstance().addMessage(null,

MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, "zipCodeNotValid",
null));
                        return "error";

however, at runtime, the givem error mesage is always displayed twice.

Any idea ?

Thanx
Andreas



Andreas Heidrich                         (Embedded
Organisationsprogrammierer/EDV Orga      image moved
Toyota Kreditbank GmbH                   to file:
Tel: +49-2234-102-1963|Fax:              pic06224.gif)
+49-2234-102-99-1963
Email: andreas.heidrich@toyota-fs.com




-------------------------------------------------------------------
Toyota Financial Services ist eine Marke der TOYOTA Kreditbank GmbH
Lexus Financial Services ist eine Marke der TOYOTA Kreditbank GmbH
TOYOTA Kreditbank GmbH
Toyota-Allee 5, Köln-Marsdorf
www.toyota-bank.de www.lexus-finance.de
Sitz der Gesellschaft: Köln - Amtsgericht Köln - HRB 18068
Ust-IdNr.: DE 811425043 - Steuernummer: 223/5819/0038
Vorsitzender des Beirates: Keji Sudo
Geschäftsführer: Peter Pollhammer - Andreas Bullock - Christian Ruben
WestLB - Konto 1846 - BLZ 300 500 00
-------------------------------------------------------------------
Toyota Financial Services ist eine Marke der TOYOTA Leasing GmbH
Lexus Financial Services ist eine Marke der TOYOTA Leasing GmbH
TOYOTA Leasing GmbH
Toyota-Allee 5, Köln-Marsdorf
www.toyota-bank.de www.lexus-finance.de
Sitz der Gesellschaft: Köln - Amtsgericht Köln - HRB 20031
Ust-IdNr.: DE 811425051 - Steuernummer: 223/5819/0038
Vorsitzender des Beirates: Keji Sudo
Geschäftsführer: Peter Pollhammer - Tadashi Ueda - Christian Ruben
WestLB - Konto 4667663 - BLZ 300 500 00
-------------------------------------------------------------------

Toyota Financial Services (UK) PLC, Company Registration Number
02299961, Great Burgh, Burgh Heath, Epsom, Surrey, KT18 5UZ,
registered in England.

Lexus Financial Services and Redline Finance are trading styles
of Toyota Financial Services (UK) PLC.

Authorised and regulated by the Financial Services Authority.
This correspondence is for the intended recipient only. It may
contain confidential or legally privileged information or both.
No confidentiality or privilege is waived or lost by any
mistransmission or unauthorised alteration during transmission.
If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. If you receive
this correspondence in error, please immediately delete it from
your system and notify the sender. Any views expressed in this
message are those of the individual sender, except where the
sender expressly, and with authority, states them to be the views
of Toyota. This message has been checked for viruses but the
recipient is strongly advised to rescan the message before
opening any attachments or attached executable files.



____________________________________________________________________________________

Sé un Mejor Amante del Cine
¿Quieres saber cómo? ¡Deja que otras personas te ayuden!
http://advision.webevents.yahoo.com/reto/entretenimiento.html




-------------------------------------------------------------------
Toyota Financial Services ist eine Marke der TOYOTA Kreditbank GmbH
Lexus Financial Services ist eine Marke der TOYOTA Kreditbank GmbH
TOYOTA Kreditbank GmbH
Toyota-Allee 5, Köln-Marsdorf
www.toyota-bank.de www.lexus-finance.de
Sitz der Gesellschaft: Köln - Amtsgericht Köln - HRB 18068
Ust-IdNr.: DE 811425043 - Steuernummer: 223/5819/0038
Vorsitzender des Beirates: Keji Sudo
Geschäftsführer: Peter Pollhammer - Andreas Bullock - Christian Ruben
WestLB - Konto 1846 - BLZ 300 500 00
-------------------------------------------------------------------
Toyota Financial Services ist eine Marke der TOYOTA Leasing GmbH
Lexus Financial Services ist eine Marke der TOYOTA Leasing GmbH
TOYOTA Leasing GmbH
Toyota-Allee 5, Köln-Marsdorf
www.toyota-bank.de www.lexus-finance.de
Sitz der Gesellschaft: Köln - Amtsgericht Köln - HRB 20031
Ust-IdNr.: DE 811425051 - Steuernummer: 223/5819/0038
Vorsitzender des Beirates: Keji Sudo
Geschäftsführer: Peter Pollhammer - Tadashi Ueda - Christian Ruben
WestLB - Konto 4667663 - BLZ 300 500 00
-------------------------------------------------------------------

Toyota Financial Services (UK) PLC, Company Registration Number 
02299961, Great Burgh, Burgh Heath, Epsom, Surrey, KT18 5UZ, 
registered in England.  

Lexus Financial Services and Redline Finance are trading styles 
of Toyota Financial Services (UK) PLC.
 
Authorised and regulated by the Financial Services Authority. 
This correspondence is for the intended recipient only. It may 
contain confidential or legally privileged information or both. 
No confidentiality or privilege is waived or lost by any 
mistransmission or unauthorised alteration during transmission. 
If you are not the intended recipient, any disclosure, copying, 
distribution or any action taken or omitted to be taken in 
reliance on it, is prohibited and may be unlawful. If you receive 
this correspondence in error, please immediately delete it from 
your system and notify the sender. Any views expressed in this 
message are those of the individual sender, except where the 
sender expressly, and with authority, states them to be the views 
of Toyota. This message has been checked for viruses but the 
recipient is strongly advised to rescan the message before 
opening any attachments or attached executable files. 
Mime
View raw message