struts2国际化与验证框架发生冲突
regist.jsp:<%@ page language="java" contentType="text/html; charset=utf-8"
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" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><s:text name="title"></s:text></title>
<style type="text/css">
td {
border-style: solid;
border-color: gray;
border-width: 1px;
}
}
</style>
<script type="text/javascript" src="<%=basePath%>jquery-1.8.2.js"></script>
<s:head />
</head>
<body>
<div align="center">
<s:set name="current_locale"
value="#session['WW_TRANS_I18N_LOCALE'] == null ?
locale : #session['WW_TRANS_I18N_LOCALE']" />
<s:url id="chinese_url" action="select">
<s:param name="request_locale" value="@java.util.Locale@CHINA"></s:param>
</s:url>
<s:url id="english_url" action="select">
<s:param name="request_locale" value="@java.util.Locale@ENGLISH"></s:param>
</s:url>
<s:if test="#current_locale.equals(@java.util.Locale@CHINA)">
<s:a href="%{#chinese_url}">
<strong> <s:text name="chinese" /></strong>
</s:a>
<s:a href="%{#english_url}">
<s:text name="english" />
</s:a>
</s:if>
<s:else>
<s:a href="%{#chinese_url}">
<s:text name="chinese" />
</s:a>
<s:a href="%{#english_url}">
<strong><s:text name="english" /> </strong>
</s:a>
</s:else>
<em><s:text name="required"></s:text> </em>
<table>
<s:form>
<tr>
<s:textfield name="user.name" key="name" />
<s:password name="user.password" key="password" />
<s:password name="repwd" key="repwd" />
<s:textfield name="user.mobil" key="mobil" />
</tr>
<tr>
<td></td>
<td>
<s:submit value="%{getText('submit')}"theme="易做图"/>
<s:submit value="%{getText('reset')}" theme="易做图" />
</td>
</tr>
</s:form>
</table>
</div>
</body>
</html>
action:
@Override
public String execute() throws Exception {
return SUCCESS;
}
struts.xml:
<package name="mypkg3" extends="struts-default" >
<action name="select" class="UserRegisterAction" >
<result >/regist.jsp</result>
<result name="input">/regist.jsp</result>
</action>
问题:在选择语言时会调用validators验证 例如:选择chinese 文本边框不填 会有 “用户名不能为空” struts2 国际化 验证框架 struts 框架 validators
补充:Java , Java EE