MultiPageMessagesSupport problem

Splash Forums PrettyFaces Users MultiPageMessagesSupport problem

This topic contains 4 replies, has 3 voices, and was last updated by  mail@s-christensen.dk 2 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #24711

    Hi

    I’m new to PrettyFaces – but the tool is amazing. It solved a big problem we had.

    However I’ve configured the phase listener in faces-config.xml – and I see when debugging that messages are saved correctly – however to get the messages saved I had to add “?faces-redirect=true&includeViewParams=true” to my return statement. Originally I just returned “pretty:base” which worked fined for the navigation part, but messages where not stored – when using the code below to fix message problem I don’t get corret navigation:

    FacesContext.getCurrentInstance().addMessage( null, new FacesMessage( "Unknown store" ));
    return "UnknownStoreIdentifier?faces-redirect=true&includeViewParams=true";
    

    Output from browser:

    Unable to find matching navigation case with from-view-id ‘/pages/unsecure/main.xhtml’ for action ‘/pages/unsecure/main.xhtml’ with outcome ‘UnknownStoreIdentifier?faces-redirect=true&includeViewParams=true’

    Faces-config.xml

    <navigation-rule>
    <from-view-id>/pages/unsecure/main.xhtml</from-view-id>
    <navigation-case>
    <from-action>/pages/unsecure/main.xhtml</from-action>
    <from-outcome>UnknownStoreIdentifier?faces-redirect=true&includeViewParams=true</from-outcome>
    <to-view-id>/pages/home/home.xhtml</to-view-id>
    <redirect />
    </navigation-case>
    </navigation-rule>

    Hope that someone can help me. Thanks in advance.

    Best regards
    Søren Christensen

    #24714

    Hmmm… Well, I can tell you that using JSF navigation is not entirely supported in PrettyFaces. Unfortunately once the JSF navigation system has been invoked, that means that all chance to intercept normal JSF navigation have passed already (thus once your faces-config.xml navigation cases are being evaluated, no extensions can intervene at this point since JSF is doing it’s default/native job.)

    However, It’s a bit strange to me that the messages would be lost. And even stranger that <redirect/> is not sufficient, and even more strange is the fact that adding ?faces-redirect=true would have any effect.

    I don’t think that your <from-outcome> should have anything other than UnknownStoreIdentifier – I don’t think the parameters should be included in your return statement, or in the config file since you are using the redirect tag.

    #24730

    So instead I should be able to do like this?:

    pretty:base?faces-redirect=true&includeViewParams=true

    #24747

    If you are using JSF 2.0 or newer, you don’t need MultiPageMessagesSupport any more in most cases. You can use the flash scope, which is able to preserve the messages. See:

    http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/javax/faces/context/Flash.html#setKeepMessages(boolean)

    #24802

    Thanks. Using the flash scope works just fine.

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

You must be logged in to reply to this topic.

Comments are closed.