Results 1 to 6 of 6

Thread: Properties resource bundle

  1. #1
    Join Date
    Feb 2012
    Posts
    29

    Question Properties resource bundle

    hello there, my second question, is how to bundle my resource?
    i do lot of thing in the end i just could prevent server to generate error, in spring context
    i used ResourceBundle bundle = ResourceBundle.getBundle("messages") (which messages are in messages_fa, messages_en as properties file), in my SimpleFormController child class

    but once i called the jsp page, i get #{messages['...']} which i defined previously in pages...
    how should i tell spring controller to send bundle to page?

    should i read it fully, and make a arrays, and map it, and used like a normal variable? but i dont think it's correct way, and it's like cheating..

  2. #2

    Default

    Quote Originally Posted by deadManN View Post
    hello there, my second question, is how to bundle my resource?
    i do lot of thing in the end i just could prevent server to generate error, in spring context
    i used ResourceBundle bundle = ResourceBundle.getBundle("messages") (which messages are in messages_fa, messages_en as properties file), in my SimpleFormController child class
    Are you trying to show localized messages in your user interface? If the answer is yes, you might want to follow these steps:

    1. Specify a message source bean your application context configuration. More information about the message source is found here: http://static.springsource.org/sprin...-messagesource
    2. Configure the locale resolver and locale change interceptor components. More about information about this is found here: http://static.springsource.org/sprin...localeresolver
    3. Use the message tag of the Spring tag library to get the message shown in the JSP page. More information about this is found here: http://static.springsource.org/sprin...ng.tld.message


    Also, if you need to generate feedback/error messages in your java code, you can wire the message source and the locale resolver beans to your class and use them to get the localized feedback / error message.

    I got an impression that at the moment you have implemented the code accessing your resource files yourself. If you decide to use this approach, you can get rid of this boilerplate code.

  3. #3
    Join Date
    Feb 2012
    Posts
    29

    Default

    I'm home by now, tomorrow, I'll test it at work, thank you for your response

  4. #4
    Join Date
    Feb 2012
    Posts
    29

    Unhappy

    Quote Originally Posted by Loke View Post
    Are you trying to show localized messages in your user interface? If the answer is yes, you might want to follow these steps:

    1. Specify a message source bean your application context configuration. More information about the message source is found here: http://static.springsource.org/sprin...-messagesource
    2. Configure the locale resolver and locale change interceptor components. More about information about this is found here: http://static.springsource.org/sprin...localeresolver
    3. Use the message tag of the Spring tag library to get the message shown in the JSP page. More information about this is found here: http://static.springsource.org/sprin...ng.tld.message


    Also, if you need to generate feedback/error messages in your java code, you can wire the message source and the locale resolver beans to your class and use them to get the localized feedback / error message.

    I got an impression that at the moment you have implemented the code accessing your resource files yourself. If you decide to use this approach, you can get rid of this boilerplate code.

    • this thing didn't worked out, there's no getLocal in RequestContext
    • there is no manual local request in document
    • there in 3rd link, there is no example of how define that thing...
    • in the end this tutorial may work for who completely are aware are spring framework, but not me, i need an example, which goes through whole the way...

  5. #5

    Default

    I might be able to provide some guidance but first I would have to know:

    Which Spring version are you using?
    Are you using XML configuration or Java configuration?

  6. #6
    Join Date
    Feb 2012
    Posts
    29

    Default

    it fixed,... i went through <spring:message code...

Posting Permissions

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