How to preserve FacesMessages across redirects with PrettyFaces using MultiPageM

Splash Forums PrettyFaces Users How to preserve FacesMessages across redirects with PrettyFaces using MultiPageM

This topic contains 6 replies, has 2 voices, and was last updated by  Lincoln Baxter III 2 years, 9 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #25234

    ZheFrench
    Participant

    Hi,

    How to preserve FacesMessages across redirects with PrettyFaces using MultiPageMessagesSupport?

    I add this in my faces-config…http://ocpsoft.org/docs/prettyfaces/snapshot/en-US/html/navigation.html#navigation.faces_messages

    I navigate between two pages Home and Particpant. The Two pages are SessionScoped (i don’t know if it’s useful for you to help)

    In Parcipant page , when i click a h:command button i want to add a message and pass it to participant page, where i am redirect but it’s not working.

    Have you an idea ? What i have to implement in addition ?

    Thanks.
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(“Ajout du participant “+id_study+” dans l’étude “+ study_name));
    //cleanForm();

    return “pretty:home”;

    #25236

    ZheFrench
    Participant

    Sorry ,

    I found the solution , i forgot to paste that in home page. <h:messages globalOnly=”true” “></h:messages>

    #25242

    Great! Glad you found the issue.

    #25286

    ZheFrench
    Participant

    Yeahhh but still have a problem when i try to specify an id …

    FacesContext.getCurrentInstance().addMessage(“:messages_info”, new FacesMessage(FacesMessage.SEVERITY_INFO,” – Ajout du participant “+id_study+” dans l’étude “+ study_name +” -“,null));

    <rich:panel id=”messages_info” style=”width:50%;margin-left:auto;margin-right:auto;text-align:center;” rendered=”#{facesContext.maximumSeverity.ordinal eq 0 }”>

    <h:messages style = “color:green;”></h:messages>
    ->#{facesContext.maximumSeverity.ordinal }
    </rich:panel>

    #25287

    Yep, our MPMS doesn’t support attaching to component IDs, but I’m sure it could be added. Want to take a shot at implementing this?

    ~Lincoln

    #25288

    ZheFrench
    Participant

    No it’s alright 🙂 I used a trick with Rendered on messages tag and SeverityErro type…
    It’s enough for me for i wanted to acheive , i will go with this. I was just curious to know if i was missing something.
    Thanks.

    #25293

    Okay! Sorry it doesn’t do that yet. Just haven’t had a need yet 🙂 One could argue that it probably shouldn’t, either, except for very specific cases. This is because you may not always want component-specific messages to re-attach after a redirect, but I’m sure you have figured that out!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Comments are closed.