Results 1 to 6 of 6

Thread: Internationalization messages in HTML tags

Hybrid View

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Mount Joy, PA
    Posts
    34

    Default

    Are you sure you've put the spring taglib directive at the top of your JSP? Are other <spring:xxx> tags working?
    ~ Daniel Miller

  3. #3

    Default

    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.

  4. #4
    Join Date
    Aug 2004
    Location
    Mount Joy, PA
    Posts
    34

    Default

    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:
    ~ Daniel Miller

  5. #5
    Join Date
    Aug 2004
    Posts
    8

    Default Re: Internationalization messages in HTML tags

    Quote 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"/>'>

  6. #6
    Join Date
    Sep 2004
    Posts
    15

    Default

    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

Similar Threads

  1. Newbie: logging acegi messages
    By cwong in forum Security
    Replies: 2
    Last Post: Sep 28th, 2007, 05:47 PM
  2. Replies: 4
    Last Post: May 12th, 2006, 02:50 AM
  3. Replies: 1
    Last Post: Sep 9th, 2005, 03:49 AM
  4. Replies: 7
    Last Post: Aug 1st, 2005, 01:38 AM
  5. Replies: 3
    Last Post: Nov 25th, 2004, 01:42 PM

Posting Permissions

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