struts2 国际化 <s:if test="%{#session.WW_TRANS_I18N_LOCALE.toString()=='zh_CN'}">
2012-03-14 01:41
567 查看
参考:http://yangzhibin-java.iteye.com/blog/441792
注意一定要用toString(),因为session.WW_TRANS_I18N_LOCALE返回的是Locale对象,只有转换成String才能比较
<s:if test="%{#session.WW_TRANS_I18N_LOCALE.toString()=='zh_CN'}"> <a href="${pageContext.request.contextPath}/admin/login_loginUI.action?request_locale=en_US">English</a> </s:if> <s:else> <a href="${pageContext.request.contextPath}/admin/login_loginUI.action?request_locale=zh_CN">中文</a> </s:else>
注意一定要用toString(),因为session.WW_TRANS_I18N_LOCALE返回的是Locale对象,只有转换成String才能比较
相关文章推荐
- <s:if test="canSubscribe == 'Y'">能 </s:if> <s:else>不能 </s:else> 单字符需加.toString()
- <s:if test="canSubscribe == 'Y'">能 </s:if> <s:else>不能 </s:else> 单字符需加.toString()
- <c:if test="${empty(*)}"> 报错javax.el.ELException: Function ':empty' not found;
- struts2中JSP无法用<jsp:forward page="test.action"> 跳转到对应的 action中解决方法
- struts2中<s:if>标签判断session问题
- <c:if test="value ne, eq, lt, gt,...."> 用法
- <c:if test="">多条件判断
- MyBatis 判断条件为等于的问题(<if test="type == '1'.toString()"> xxx </if>
- struts2标签 截取字符串 <s:if test=""></if>判断
- 在Jsp中使用<s:if test="">,条件的值是action中设置的session的值
- <c:if test="value ne, eq, lt, gt,...."> 用法
- <c:if test="value ne, eq, lt, gt,...."> 用法
- jstl 的if else <c:choose><c:when test="">如果</c:when><c:otherwise>否则</c:otherwise></c:choose>
- <c:if test="${fn:contains(name, searchString)}">
- struts2中通过<s:if></s:if>标签来判断session是否为空并作出相应处理
- <c:if test="value ne, eq, lt, gt,...."> 用法
- 注意在<s:if test="#session.user.power==0">中不能用 <s:if test=$sessionScope.user.power==0">
- struts2文件下载及 <param name="inputName">inputStream</param>的理解
- 关于 '<a[^>]+href=["\'](.*?)["\']' 的解释
- <s:if test>的应用