<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>中英文切换</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<s:head />
<sx:head parseContent="true" />
</head> <body>
<br />
<br />
<s:fielderror></s:fielderror>
<s:set name="current_locale"
value="#session['WW_TRANS_I18N_LOCALE']==null?locale:#session['WW_TRANS_I18N_LOCALE']">
</s:set>
<!-- 获取当前的local -->
<s:url id="chi" value="e377rege.action">
<s:param name="request_locale" value="@java.util.Locale@CHINA"></s:param>
</s:url>
<s:url id="eng" value="e377rege.action">
<s:param name="request_locale" value="@java.util.Locale@ENGLISH"></s:param>
</s:url>
<s:if test="#current_locale.equals(@java.util.Locale@CHINA)">
<sx:a href="%{#chi}">
<strong>1<s:text name="chinese" />
</strong>
</sx:a>
&nbsp;
<sx:a href="%{#eng}">
1<s:text name="english" />
</sx:a>
</s:if>
<s:else>
<sx:a href="%{#chi}">
2<s:text name="chinese" />
</sx:a>
&nbsp;
<sx:a href="%{#eng}">
<strong>2<s:text name="english" />
</strong>
</sx:a>
</s:else>
<s:form>
<s:text name="timu"></s:text>
<table width="239" border="1" bgcolor="#FFCCFF">
<tr>
<td width="92">
<s:textfield name="username" key="username"></s:textfield>
</td>
</tr>
<tr>
<td>
<s:textfield name="password" key="password"></s:textfield>
</td>
</tr>
<tr>
<td>
<s:submit name="submit" key="submit"></s:submit>
</td>
</tr>
</table>
</s:form>
</body>
</html>我要求实现中英文的切换,目前始终无法实现,只能是中文。
Resources_en.properties
Resources_zh_CN.properties
<action name="e377rege" class="e377.cn.mr.action.RegisterAction">
<interceptor-ref name="defaultStack" />
<result name="success">/e377/index.jsp</result>
</action>
import com.opensymphony.xwork2.ActionSupport;
public class RegisterAction extends ActionSupport {
public String execute() {
return SUCCESS;
}
}