Results 1 to 5 of 5

Thread: JSTL message bundle with Spring

  1. #1

    Default JSTL message bundle with Spring

    How do I set a label property of a Spring radiobutton with a message from a bundle? e.g
    Code:
    <form:radiobutton	label="administrator" path="admin"    value="U" />
    How would I retrieve the "administrator" value from a bundle. I already have a bundle set up. If I do this
    Code:
    <fmt:message	key="info.administrator" />
    inside a td, I get the value but the trouble is accessing this value in a Spring control.

    Can somebody help?

  2. #2

    Default

    Easiest way would be to use a c:set
    Code:
    <c:set var="bundleValue">
    <fmt:message	key="info.administrator" />
    </c:set>
    and for the radio button:
    Code:
    <form:radiobutton	label="${bundleValue}" path="admin"    value="U" />
    But I think it should be possible to do it dirrectly, bypassing the c:set
    Last edited by laura; Jul 28th, 2008 at 04:33 AM.

  3. #3

    Default

    That worked, thanks Laura.

  4. #4
    Join Date
    Oct 2006
    Posts
    228

    Default

    Quote Originally Posted by laura View Post
    But I think it should be possible to do it dirrectly, bypassing the c:set
    Yes it is, try:

    Code:
    <fmt:message key="info.administrator" var="bundleValue"/>

  5. #5

    Default

    That's even better! Thanks cmelgar.

Posting Permissions

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