Results 1 to 3 of 3

Thread: Question related to messageSource

  1. #1
    Join Date
    May 2005
    Location
    BEEK, The Netherlands
    Posts
    230

    Default Question related to messageSource

    Hi,
    This question is just partly related to Roo.
    I'm using Roo as "best-practice-template" for a Spring app.

    I also used the messageSource definition in the springmvc-config.xml..

    However I keep getting a:
    No message found under code 'my.title' for locale 'en_US'.
    when using <spring:message code="my.title" />

    I checked the config a couple of time but don't see anything wrong.
    When I inject the messageSource in a controller I can retrieve the message using getMessage(..) without a problem, so the bundle is loaded.

    Then I bumped against this thread http://forum.springsource.org/showthread.php?t=18199 and I moved the messageSource bean from springmvc-config to applicationContext and the the <spring:message code="my.title" /> works!

    Now I'm wondering why is it working inside springmvc-config for Roo. Is there some special magic going on there?

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    I'm having a hard time reproducing this problem.

    Here's what I did:

    1. Run script wedding.roo and quit Roo
    2. Add to src/main/webapp/WEB-INF/i18n/messages.properties:
    Code:
    my.title="Hello world"
    3. Add to src/main/webapp/WEB-INF/views/rsvp/create.jspx:
    Code:
    The message is: <spring:message code="my.title"/> <br/>
    When I then mvn tomcat:run, and I elected to create a new RSVP, I correctly saw, The message is: Hello world".

    So it seems to be working out-of-the-box as far as I can see. Can you please clarify what I need to do to reproduce the problem?
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  3. #3
    Join Date
    May 2005
    Location
    BEEK, The Netherlands
    Posts
    230

    Default

    Sorry Ben, I wasn't clear enough.

    I'm not using Roo currently, but I'm "using" it's best practices, by using same applicationContext, urlrewrite etc. So I use it as an example for a cusom plain Spring app.

    Including messageSource bean in webmvc-config. But the message was not displayed, unitil I moved messageSource to applicationContext.xml. I did this following some comments in a different thread I mentioned in my earlier post.

    I'm just wondering why it works in Roo, I guess there is nothing special going on?

Posting Permissions

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