Results 1 to 2 of 2

Thread: programatically looking up a i18n value from messageSource

  1. #1
    Join Date
    Sep 2004
    Location
    Boston, US
    Posts
    130

    Default programatically looking up a i18n value from messageSource

    Is there a way to programatically lookup an i18n key from a configured messageSource? I'm working with some tags that are not EL aware and I need to pass in a label value after doing to i18n lookup.

    Thanks,
    Sanjiv

  2. #2
    Join Date
    Sep 2004
    Location
    Boston, US
    Posts
    130

    Default

    I figured out how to do this. Incase anyone else is interested, here's how I did it.

    Basically add the bean property 'requestContextAttribute' on the InternalResourceViewResolver as below. 'requestContextAttribute' is of type org.springframework.web.servlet.support.RequestCon text and is made available as a request attribute ("rc", in this case) to the view and has convenience methods to look up messages from the configured messageSource.

    <bean id="viewResolver" class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <property name="viewClass"> <value>org.springframework.web.servlet.view.JstlVi ew</value>
    </property>
    <property name="requestContextAttribute"><value>rc</value></property>
    <property name="prefix">
    <value>/jsp/</value>
    </property>
    <property name="suffix">
    <value>.jsp</value>
    </property>
    </bean>

Similar Threads

  1. Internationalization (i18n)
    By Xtreme in forum Swing
    Replies: 0
    Last Post: May 30th, 2005, 11:06 AM
  2. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  3. Replies: 3
    Last Post: May 16th, 2005, 11:14 PM
  4. Replies: 1
    Last Post: Apr 13th, 2005, 04:46 PM
  5. basic i18n
    By bernardsirius in forum Web
    Replies: 1
    Last Post: Feb 8th, 2005, 07:25 AM

Posting Permissions

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