You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bridges-dev@portals.apache.org by "Peter Bødskov (JIRA)" <br...@portals.apache.org> on 2008/05/16 13:35:55 UTC

[jira] Created: (PB-80) FacesMessages are not displayed in the same order as the are added

FacesMessages are not displayed in the same order as the are added
------------------------------------------------------------------

                 Key: PB-80
                 URL: https://issues.apache.org/jira/browse/PB-80
             Project: Portals Bridges
          Issue Type: Improvement
          Components: jsf
    Affects Versions: 1.0.3
         Environment: WebSphere Portal 6.0, MyFaces 1.1.5, Portals Bridges 1.0.3
            Reporter: Peter Bødskov


In a BackingBean we have validation along the lines of this:

if( ! validator.isTextValid(getText1())){
   FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 1", "this is message no 1");
   getFacesContext().addMessage(compId, msg);
}

if( ! validator.isTextValid(getText2())){
   FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 2", "this is message no 2");
   getFacesContext().addMessage(compId, msg);
}

if( ! validator.isTextValid(getText3())){
   FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this 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 
this is message no 2 
this is message no 3 

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 
this is message no 2 
this is message no 1

The reason for this is found in the saveFacesMessages method from the FacesPortlet

if (msgs != null && msgs.hasNext()) {
	    Map facesMsgs = new HashMap();
            ...
            ...
 session.setAttribute("FACES_MESSAGES", facesMsgs);

When the HashMap facesMsgs is stored on the session, the order of the FacesMessage elemets in facesMsgs will be mixed. Therefore, when the messages are retrieved again in the method restoreFacesMessages, the order of the messages is no longer the same as when they was added from FacesContext to facesMsgs.

I've tried replacing:

Map facesMsgs = new HashMap();

with

Map facesMsgs = new LinkedHashMap();

in saveFacesMessages, and that did the trick for me :-)



-- 
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


[jira] Updated: (PB-80) FacesMessages are not displayed in the same order as they are added

Posted by "Peter Bødskov (JIRA)" <br...@portals.apache.org>.
     [ https://issues.apache.org/jira/browse/PB-80?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Bødskov updated PB-80:
----------------------------

    Issue Type: Bug  (was: Improvement)

> 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ødskov
>
> In a BackingBean we have validation along the lines of this:
> if( ! validator.isTextValid(getText1())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 1", "this is message no 1");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText2())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 2", "this is message no 2");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText3())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this 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 
> this is message no 2 
> this is message no 3 
> 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 
> this is message no 2 
> this is message no 1
> The reason for this is found in the saveFacesMessages method from the FacesPortlet
> if (msgs != null && msgs.hasNext()) {
> 	    Map facesMsgs = new HashMap();
>             ...
>             ...
>  session.setAttribute("FACES_MESSAGES", facesMsgs);
> When the HashMap facesMsgs is stored on the session, the order of the FacesMessage elemets in facesMsgs will be mixed. Therefore, when the messages are retrieved again in the method restoreFacesMessages, the order of the messages is no longer the same as when they was added from FacesContext to facesMsgs.
> I've tried replacing:
> Map facesMsgs = new HashMap();
> with
> Map facesMsgs = new LinkedHashMap();
> in saveFacesMessages, and that did the trick for me :-)

-- 
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


[jira] Updated: (PB-80) FacesMessages are not displayed in the same order as they are added

Posted by "Peter Bødskov (JIRA)" <br...@portals.apache.org>.
     [ https://issues.apache.org/jira/browse/PB-80?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Bødskov updated PB-80:
----------------------------

    Summary: FacesMessages are not displayed in the same order as they are added  (was: FacesMessages are not displayed in the same order as the are added)

> 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: Improvement
>          Components: jsf
>    Affects Versions: 1.0.3
>         Environment: WebSphere Portal 6.0, MyFaces 1.1.5, Portals Bridges 1.0.3
>            Reporter: Peter Bødskov
>
> In a BackingBean we have validation along the lines of this:
> if( ! validator.isTextValid(getText1())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 1", "this is message no 1");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText2())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 2", "this is message no 2");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText3())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this 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 
> this is message no 2 
> this is message no 3 
> 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 
> this is message no 2 
> this is message no 1
> The reason for this is found in the saveFacesMessages method from the FacesPortlet
> if (msgs != null && msgs.hasNext()) {
> 	    Map facesMsgs = new HashMap();
>             ...
>             ...
>  session.setAttribute("FACES_MESSAGES", facesMsgs);
> When the HashMap facesMsgs is stored on the session, the order of the FacesMessage elemets in facesMsgs will be mixed. Therefore, when the messages are retrieved again in the method restoreFacesMessages, the order of the messages is no longer the same as when they was added from FacesContext to facesMsgs.
> I've tried replacing:
> Map facesMsgs = new HashMap();
> with
> Map facesMsgs = new LinkedHashMap();
> in saveFacesMessages, and that did the trick for me :-)

-- 
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


[jira] Assigned: (PB-80) FacesMessages are not displayed in the same order as they are added

Posted by "David Sean Taylor (JIRA)" <br...@portals.apache.org>.
     [ https://issues.apache.org/jira/browse/PB-80?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Sean Taylor reassigned PB-80:
-----------------------------------

    Assignee: David Sean Taylor

> 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ødskov
>            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 = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 1", "this is message no 1");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText2())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 2", "this is message no 2");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText3())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this 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 
> this is message no 2 
> this is message no 3 
> 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 
> this is message no 2 
> this is message no 1
> The reason for this is found in the saveFacesMessages method from the FacesPortlet
> if (msgs != null && msgs.hasNext()) {
> 	    Map facesMsgs = new HashMap();
>             ...
>             ...
>  session.setAttribute("FACES_MESSAGES", facesMsgs);
> When the HashMap facesMsgs is stored on the session, the order of the FacesMessage elemets in facesMsgs will be mixed. Therefore, when the messages are retrieved again in the method restoreFacesMessages, the order of the messages is no longer the same as when they was added from FacesContext to facesMsgs.
> I've tried replacing:
> Map facesMsgs = new HashMap();
> with
> Map facesMsgs = new LinkedHashMap();
> in saveFacesMessages, and that did the trick for me :-)

-- 
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


[jira] Work started: (PB-80) FacesMessages are not displayed in the same order as they are added

Posted by "David Sean Taylor (JIRA)" <br...@portals.apache.org>.
     [ https://issues.apache.org/jira/browse/PB-80?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on PB-80 started by David Sean Taylor.

> 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ødskov
>            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 = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 1", "this is message no 1");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText2())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 2", "this is message no 2");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText3())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this 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 
> this is message no 2 
> this is message no 3 
> 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 
> this is message no 2 
> this is message no 1
> The reason for this is found in the saveFacesMessages method from the FacesPortlet
> if (msgs != null && msgs.hasNext()) {
> 	    Map facesMsgs = new HashMap();
>             ...
>             ...
>  session.setAttribute("FACES_MESSAGES", facesMsgs);
> When the HashMap facesMsgs is stored on the session, the order of the FacesMessage elemets in facesMsgs will be mixed. Therefore, when the messages are retrieved again in the method restoreFacesMessages, the order of the messages is no longer the same as when they was added from FacesContext to facesMsgs.
> I've tried replacing:
> Map facesMsgs = new HashMap();
> with
> Map facesMsgs = new LinkedHashMap();
> in saveFacesMessages, and that did the trick for me :-)

-- 
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


[jira] Resolved: (PB-80) FacesMessages are not displayed in the same order as they are added

Posted by "David Sean Taylor (JIRA)" <br...@portals.apache.org>.
     [ https://issues.apache.org/jira/browse/PB-80?page=com.atlassian.jira.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ødskov
>            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 = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 1", "this is message no 1");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText2())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this is message no 2", "this is message no 2");
>    getFacesContext().addMessage(compId, msg);
> }
> if( ! validator.isTextValid(getText3())){
>    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "this 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 
> this is message no 2 
> this is message no 3 
> 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 
> this is message no 2 
> this is message no 1
> The reason for this is found in the saveFacesMessages method from the FacesPortlet
> if (msgs != null && msgs.hasNext()) {
> 	    Map facesMsgs = new HashMap();
>             ...
>             ...
>  session.setAttribute("FACES_MESSAGES", facesMsgs);
> When the HashMap facesMsgs is stored on the session, the order of the FacesMessage elemets in facesMsgs will be mixed. Therefore, when the messages are retrieved again in the method restoreFacesMessages, the order of the messages is no longer the same as when they was added from FacesContext to facesMsgs.
> I've tried replacing:
> Map facesMsgs = new HashMap();
> with
> Map facesMsgs = new LinkedHashMap();
> in saveFacesMessages, and that did the trick for me :-)

-- 
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