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


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

查看所有标签

猜你喜欢:

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

Hatching Twitter

Hatching Twitter

Nick Bilton / Portfolio Hardcover / 2013-11-5 / USD 28.95

The dramatic, unlikely story behind the founding of Twitter, by New York Times bestselling author and Vanity Fair special correspondent The San Francisco-based technology company Twitter has become......一起来看看 《Hatching Twitter》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具