There is a page with a login form, after filling the correct pair login-password go to the main page of the website, and display an informational message that the authorization was successful. It should be noted that the transition to the main page redirect is happening in a query (how to redirect
the welcome?faces-redirect=true
or
it does not matter).
The message is placed in
FacesContext
as follows:
FacesContext facesContext = FacesContext.getCurrentInstance(); FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_INFO, message, null); facesContext.addMessage(null, facesMessage);
The problem is that after redirect
shows an information message. At the same time, if the redirection is not done, but limited to one POST request, then an informational message is displayed.
Tried to activate
FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true)
but this mechanism helps to display the message only on the current page, even if we will return later, but on another page (another url)
can't get the message.
Accordingly,
the question is how to display an informational message after redirect?
Maybe somewhere, you need to specify the correct scope for
or
FacesMessage
?
The project to spin on Glassfish 3, Java EE 6, JSF 2.