Announcement Announcement Module
Collapse
No announcement yet.
Internationalization messages in HTML tags Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Internationalization messages in HTML tags

    Does anyone know how to pull a message out of the messages.properties file and use it as the value in a button?

    For example,

    messages.properties would look like:

    label.search=Search

    on the jsp I want:

    <input type="button" value="<spring:message code="label.search"/>">

    I want the button to say Search, but of course it doesn't, it says what I put in those quotes. Thoughts?

    Thanks!

  • #2
    Are you sure you've put the spring taglib directive at the top of your JSP? Are other <spring:xxx> tags working?

    Comment


    • #3
      Yeah, I'm using the <spring:message> tag all over the page and they are showing up correctly. It's just when I put it inside an HTML tag like I showed that it doesn't work.

      Comment


      • #4
        All I can think of is to try the equivalent jstl tag: <fmt:message ... >. It's the same as <spring:message> as far as I know. I use that regularly in the exact scenario you are talking about and it's never been a problem.

        Sorry I don't have any better advice :cry:

        Comment


        • #5
          Re: Internationalization messages in HTML tags

          Originally posted by Rexxe
          <input type="button" value="<spring:message code="label.search"/>">

          I want the button to say Search, but of course it doesn't, it says what I put in those quotes. Thoughts?

          Thanks!
          Try
          <input type="button" value='<spring:message code="label.search"/>'>

          Comment


          • #6
            If you have EL, this works too... more verbose imho:

            Code:
            <spring&#58;message code="my.button" var="tmpMyButton"/>
            <input type="button" value"$&#123;tmpMyButton&#125;">
            /a

            Comment

            Working...
            X