Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何在 OGNL 中获取请求语言环境?
现在我使用
<s:set var="locale" value='#session.WW_TRANS_I18N_LOCALE?#session.WW_TRANS_I18N_LOCALE.toString():"zh_CN"'/>
这必须假设初始值为“zh_CN”。
所以我需要知道如何在 OGNL 中获取请求语言环境。
谢谢
#request.locale
#request.locale返回 java.util.Locale 对象
尝试
<s:if test="#request.locale.language=='en'"> Current Locale is ENGLISH </s:if> <s:else test="#request.locale.language=='fr'"> Current Locale is FRANCE </s:else>