Results 1 to 3 of 3

Thread: getting messages from the MessageSource unescaped

  1. #1

    Default getting messages from the MessageSource unescaped

    I'm using Spring's MessageSource to output localized Strings in my JSF view. Generally, it's great that Spring does escape them (e.g. for < or > in Texts), but every now and then I would like to be able to output a text with HTML in it. For JSP pages, there is a tag with an escape attribute, but I don't think I can use this in a Facelets page, right? ... I just tried that to be sure and it didn't output anything (spring:message tag).

    So, my question is, is there a way to configure how messages are retrieved from the MessageSource in a Facelets environment, either globally or on a case-by-case basis?
    Spring 2.5.6, Spring WebFlow 2.0.8, MyFaces 1.2.5, Facelets, JDK 1.6.0, Tomcat 6

  2. #2
    Join Date
    Nov 2008
    Posts
    742

    Default

    Not sure about configuring this globally. However, you can use JSF's outputText tag. It has an escape attribute you can set to false:

    Code:
    <h:outputText value="#{resourceBundle.myMessageKey}" escape="false"/>

  3. #3

    Default

    Thanks a lot for your answer, InverseFalcon! That was exactly what I was looking for! I thought that I had tried that, but obviously I didn't... ;-)
    Spring 2.5.6, Spring WebFlow 2.0.8, MyFaces 1.2.5, Facelets, JDK 1.6.0, Tomcat 6

Posting Permissions

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