Results 1 to 4 of 4

Thread: integration of messageContext with JSF messages

  1. #1
    Join Date
    Apr 2010
    Posts
    24

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

  2. #2
    Join Date
    Nov 2008
    Posts
    742

    Default

    You will need to use a MessageBuilder, and add the built message to the MessageContext.

    See the SWF reference guide for usage.

  3. #3
    Join Date
    Apr 2010
    Posts
    24

    Default MessageContext

    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.

  4. #4
    Join Date
    Nov 2008
    Posts
    742

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •