Return-Path: Delivered-To: apmail-portals-bridges-dev-archive@www.apache.org Received: (qmail 73397 invoked from network); 4 Jul 2008 17:08:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jul 2008 17:08:41 -0000 Received: (qmail 41706 invoked by uid 500); 4 Jul 2008 17:08:42 -0000 Delivered-To: apmail-portals-bridges-dev-archive@portals.apache.org Received: (qmail 41682 invoked by uid 500); 4 Jul 2008 17:08:42 -0000 Mailing-List: contact bridges-dev-help@portals.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bridges-dev@portals.apache.org Delivered-To: mailing list bridges-dev@portals.apache.org Received: (qmail 41671 invoked by uid 99); 4 Jul 2008 17:08:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jul 2008 10:08:42 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jul 2008 17:07:59 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 396BC234C154 for ; Fri, 4 Jul 2008 10:07:51 -0700 (PDT) Message-ID: <2053746206.1215191271233.JavaMail.jira@brutus> Date: Fri, 4 Jul 2008 10:07:51 -0700 (PDT) From: "David Sean Taylor (JIRA)" To: bridges-dev@portals.apache.org Subject: [jira] Resolved: (PB-80) FacesMessages are not displayed in the same order as they are added In-Reply-To: <1960942843.1210937755845.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/PB-80?page=3Dcom.atlassian.jir= a.plugin.system.issuetabpanels:all-tabpanel ] David Sean Taylor resolved PB-80. --------------------------------- Resolution: Fixed Fix Version/s: 1.0.4 patch applied to trunk > FacesMessages are not displayed in the same order as they are added > ------------------------------------------------------------------- > > Key: PB-80 > URL: https://issues.apache.org/jira/browse/PB-80 > Project: Portals Bridges > Issue Type: Bug > Components: jsf > Affects Versions: 1.0.3 > Environment: WebSphere Portal 6.0, MyFaces 1.1.5, Portals Bridges= 1.0.3 > Reporter: Peter B=C3=B8dskov > Assignee: David Sean Taylor > Fix For: 1.0.4 > > > In a BackingBean we have validation along the lines of this: > if( ! validator.isTextValid(getText1())){ > FacesMessage msg =3D new FacesMessage(FacesMessage.SEVERITY_ERROR, "th= is is message no 1", "this is message no 1"); > getFacesContext().addMessage(compId, msg); > } > if( ! validator.isTextValid(getText2())){ > FacesMessage msg =3D new FacesMessage(FacesMessage.SEVERITY_ERROR, "th= is is message no 2", "this is message no 2"); > getFacesContext().addMessage(compId, msg); > } > if( ! validator.isTextValid(getText3())){ > FacesMessage msg =3D new FacesMessage(FacesMessage.SEVERITY_ERROR, "th= is is message no 3", "this is message no 3"); > getFacesContext().addMessage(compId, msg); > } > Where getText()1, getText2() and getText3() retireves the value of 3 text= fields from a form. > This results in 3 messages being added to FacesContext in the order: > this is message no 1=20 > this is message no 2=20 > this is message no 3=20 > But, when these messages are displayed in a JSP page in a h:messages tag,= they're displayed in this order: > this is message no 3=20 > this is message no 2=20 > this is message no 1 > The reason for this is found in the saveFacesMessages method from the Fac= esPortlet > if (msgs !=3D null && msgs.hasNext()) { > =09 Map facesMsgs =3D new HashMap(); > ... > ... > session.setAttribute("FACES_MESSAGES", facesMsgs); > When the HashMap facesMsgs is stored on the session, the order of the Fac= esMessage elemets in facesMsgs will be mixed. Therefore, when the messages = are retrieved again in the method restoreFacesMessages, the order of the me= ssages is no longer the same as when they was added from FacesContext to fa= cesMsgs. > I've tried replacing: > Map facesMsgs =3D new HashMap(); > with > Map facesMsgs =3D new LinkedHashMap(); > in saveFacesMessages, and that did the trick for me :-) --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: bridges-dev-unsubscribe@portals.apache.org For additional commands, e-mail: bridges-dev-help@portals.apache.org