java - Spring MVC i18n not working -


I'm not able to get internationalization in my project to run I'am.
I have tried many stack overfollow solutions and without the success the online tutorial message-key, which I want to receive, can not be found and the locale / long can not be switched.

Here is the i18n portion of my servlet-context.xml:

   & Lt; Beans: Property Name = "Default Encoding" value = "UTF-8" /> & Lt; / Bean: beans & gt; & Lt; Beam: Bean id = "locale change interactive" class = "org.springframework.web.servlet.i18n.LocaleChangeInterceptor" & gt; & Lt; Beans: Properties Name = "Paramount" Value = "Lang" /> & Lt; / Bean: beans & gt; & Lt; Beam: Bean id = "locale resolver" class = "org.springframework.web.servlet.i18n.CookieLocaleResolver" & gt; & Lt; Beans: property name = "default locale" value = "n" /> & Lt; / Bean: beans & gt; & Lt; Beans: Bean id = "Handler mapping" category = "org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" & gt; & Lt; Beans: Property Name = "Interceptor" & gt; & Lt; Beans: referee bean = "locale change interceptor" /> & Lt; / Beans: property & gt; & Lt; / Bean: beans & gt;   

HandlerMapping is marked as deprecated

and this is part of my jsp where I get the message. (Spring namspace :):

  & lt; Spring: Message code = "btn.ok" />   

My message-property files are located under source / main / resources

This is the Spring Maven project created with the spring equipment suite.

Does anyone know where the problem is and how can I add labels_en.properties like messages_en in other properties with a different name, and so on ...?

It seems that I can not be defined in spring: the message tag to select one (label or message).

Edit: This seems to me the exception:

  for servlet.service () for servlet on the [appServlet] path [/ MyApp] With the exception thrown in context [javax.servlet.ServletException: javax.servlet.jsp.JspTagException found below the code 'btn.ok' for any message location 'en'. Org.springframework.web.servlet.tags. MessageTag.doStartTagInternal (MessageTag.java:184) ...   

EDIT2:
What if I want to divide my property key into multiple files, for a label of a message for one ..?
is something like this (bundle entry does not exist)

    

In the same view / jsp

EDIT3:
I'm finally working:

  & lt; Bean id = "Message source" class = "org.springframework.context.support.ResourceBundleMessageSource" & gt; & Lt; Property Name = "BaseName" value = "Message" /> & Lt; Property Name = "Default Encoding" value = "ISO-885 9 -2" /> & Lt; / Bean & gt; & Lt; MVC: Interceptor & gt; & Lt; Bean id = "locale change interruptor" class = "org.springframework.web.servlet.i18n.LocaleChangeInterceptor" & gt; & Lt; Property name = "nickname" value = "lang" /> & lt; / Bean & gt; & Lt; / MVC: Interceptor & gt; & Lt; Bean id = "locale resolver" category = "org.springframework.web.servlet.i18n.CookieLocaleResolver" & gt; & Lt; Property Name = "Default Local" value = "N" /> & Lt; / Bean & gt;    

After

Are you sure that the message "btn.ok" in your message property is doing Are you

Does anyone know where the problem is and how can I add labels_en.properties like messages_en in other properties with a different name, and so on ...?

You must change your named asset. Ex:

  & lt; Beans: Properties name = "bassname" value = "square path: label" />    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -