java – 无法更改HTTP接受标头 – 使用不同的区域设置解析策略

栏目: Java · 发布时间: 6年前

内容简介:将bean id从“localResolver”更改为“localeResolver”翻译自:https://stackoverflow.com/questions/23766446/cannot-change-http-accept-header-use-a-different-locale-resolution-strategy

我在Pluralsight上关注Spring mvc课程,在运行我的应用程序时,我有“无法更改HTTP接受标头 – 使用不同的区域设置解析策略”这个错误.

在此之前,我将theese beans添加到servlet-config.xml

<mvc:interceptors>
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="language" />
</mvc:interceptors>         

<bean id="localResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" p:defaultLocale="en" />

在资源文件夹中我有两个文件. messages_es.properties和messages.properties.一个hasgoal.text = Minutos Ejercicio paraelíídehoy:和其他goal.text =分钟今日锻炼:

所以目标是选择语言.

在jsp文件中,我有关于它的这一行

语言:<a href =“?language = en”>英语</ a> |<a href =“?language = es”>西班牙语</ a>

那么我怎样才能让它正常工作呢?

将bean id从“localResolver”更改为“localeResolver”

翻译自:https://stackoverflow.com/questions/23766446/cannot-change-http-accept-header-use-a-different-locale-resolution-strategy


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Tagging

Tagging

Gene Smith / New Riders / 2007-12-27 / GBP 28.99

Tagging is fast becoming one of the primary ways people organize and manage digital information. Tagging complements traditional organizational tools like folders and search on users desktops as well ......一起来看看 《Tagging》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具