Announcement Announcement Module
Collapse
No announcement yet.
[SWF2 + Spring Faces] I18N Error Messages Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SWF2 + Spring Faces] I18N Error Messages

    I have a class, called on a flow transition, which carries out cross field validaton. I pass the MessageContext to the validate method along with the object to be validated. To support I18N, I want to obtain the error message from the message.properties files and so made the validating class implement MessageSourceAware and stored a reference to the MessageSource in order to make it available in the validation method. However, MessageSource is not serializable and so the flow failed. I understand I could make the MessageSource reference transient, but if I did this, would the setMessageSource setter be re-called when the class was de-serialised? If not (or even if so) does anyone know of a better way to access messages from properties files in validator type classes?

    Stewart

  • #2
    Maybe I'm missing something here. If you have a messages.properties file in the same directory as your flow, it will automatically be picked up and used. You can use the MessageBuilder to build your message, passing along codes to be evaluated and corresponding arguments, and when saved to the MessageContext the messages will be built against the entries in your properties file.

    Comment


    • #3
      Thanks InverseFalcon, hadn't looked closely enough at MessageBuilder, got too involved in MessageSources etc.

      Stewart

      Comment

      Working...
      X