从httpsession中检索浏览器区域设置? [英] Retrieve browser locale from httpsession?

查看:147
本文介绍了从httpsession中检索浏览器区域设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从httpsession对象(javax.servlet.http.HttpSession)派生首选语言?
有可能从servletrequest获得它,但我没有。
感谢任何想法。
Sven

Is it possible to derive the preferred language from a httpsession object (javax.servlet.http.HttpSession) ? It is possible to get it from the servletrequest but I dont have that. Thanks for any ideas. Sven

推荐答案

用户的首选语言环境可用作请求标头(Accept-Language)。它由用户的浏览器根据其偏好自动填写。
然后,您可以将此信息存储在用户的会话中,并在适当的时候检索它。

The preferred Locale for a user is available as a request header ("Accept-Language"). It is automatically filled in by the user's browser according to its preferences. Then, you can store this info in the user's session and retrieve it later when appropriate.

这篇关于从httpsession中检索浏览器区域设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆