<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>" rel="external nofollow" >
<title></title>
</head>
<body>
<s:i18n name="globalMessages">
<s:text name="check"></s:text>:
<a href="login.action?request_locale=zh_CN" rel="external nofollow" ><s:text name="chinese"></s:text></a>
<a href="login.action?request_locale=en_US" rel="external nofollow" ><s:text name="english"></s:text></a>
<br/>
<h3><s:text name="title"></s:text></h3>
<s:form action="login" method="post">
<table width="344" height="300">
<tr>
<td> </td>
</tr>
<tr>
<td><s:text name="username" />
<td><s:textfield name="name" />
</td>
</tr>
<tr>
<td><s:text name="password" />
</td>
<td><s:password name="password" />
</td>
</tr>
<tr>
<td> </td>
<td><s:submit value="%{getText('login')}" /></td>
</tr>
</table>
</s:form>
</s:i18n>
</body>
</html>
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport{
private static final long serialVersionUID = 8153220869598441387L;
@Override
public String execute() throws Exception {
return SUCCESS;
}
}
public class CheckInterceptor extends AbstractInterceptor{
private static final long serialVersionUID = -1112495747942034188L;
@Override
public String intercept(ActionInvocation ai) throws Exception {
ActionContext ac = ai.getInvocationContext();
Map session = ac.getSession();
Locale locale = (Locale)session.get("WW_TRANS_I18N_LOCALE");
if(locale==null){
locale = new Locale("zh","CN");
session.put("WW_TRANS_I18N_LOCALE",locale);
}
return ai.invoke();
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.costom.i18n.resources" value="globalMessages"/>
<package name="default" extends="struts-default" namespace="/">
<interceptors>
<interceptor name="myInter" class="org.locale.action.CheckInterceptor"></interceptor>
</interceptors>
<action name="login" class="org.locale.action.LoginAction">
<result name="success">/index.jsp</result>
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="myInter"></interceptor-ref>
</action>
</package>
</struts>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有