Jul 17th, 2010, 03:11 PM
integration of messageContext with JSF messages
I am using JSF 1.1 pages with the JSF message tag for global and form field messages. When using web flow 2.0.9, what is the easiest way to get a custom message to display that comes from the backend. The middle tier delivers message text when there is an error, and we want to display this to the user as it is. I know there is a messageContext variable available in the flow, but how do I add the message to it from the Java code I am invoking and get it to display in the JSF tag without having to use a spring-specific tag? Previously, we just invoked the FacesContext and added the message through the current instance. This is not available at the beginning of the web flow.
Jul 19th, 2010, 12:13 PM
You will need to use a MessageBuilder, and add the built message to the MessageContext.
See the SWF reference guide for usage.
Jul 22nd, 2010, 03:43 PM
I have modified my code so that I pass in the messageContext parameter as shown in the examples and then add the message accordingly. It doesn't seem to end up in the faces message object when displayed on the JSP page, though. Do I need to insert the modified MessageContext back into the request or session to get it recognized? From the documentation, it would seem that it is automatic. Maybe I am missing a step or something.
Jul 26th, 2010, 12:58 PM
Keep in mind JSF id's are often prefixed, usually by the containing form's id. Also, play around with the globalOnly attribute of your h:messages and see what happens.
Tags for this Thread