Announcement Announcement Module
Collapse
No announcement yet.
Set different summary and detail for a message with MessageBuilder Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Set different summary and detail for a message with MessageBuilder

    With FacesMessage we can set severity, summary and detail with any message. But with MessageBuilder we can set severity and a text and that text is used a summary as well as detail. What if I want to set different summary and detail for a message..how can I do it using MessageBuilder?

  • #2
    no ideas yet ?

    I have this problem too, no solutions yet ?

    Comment


    • #3
      Same problem here. Digging in the code, I found the class org.springframework.faces.webflow.FlowFacesContext MessageDelegate. I made a helper class that uses the same mechanism:

      Code:
      @Service
      public class MsgAppender
      {
      	/**
      	 * Key for identifying summary messages
      	 */
      	static final String SUMMARY_MESSAGE_KEY = "_summary";
      
      	/**
      	 * Key for identifying detail messages
      	 */
      	static final String DETAIL_MESSAGE_KEY = "_detail";
      
      	public void error(String id, String msg, MessageContext ctx)
      	{
      		final MessageBuilder builder = new MessageBuilder();
      		ctx.addMessage(builder.error().source(id + SUMMARY_MESSAGE_KEY)
      				.defaultText("Error: ").build());
      		ctx.addMessage(builder.error().source(id + DETAIL_MESSAGE_KEY)
      				.defaultText(msg).build());
      	}
      I don't know if exists a better solution, but this works (for now )

      Comment

      Working...
      X