本人已经找到解决办法,以下代码引至stingJavaNet(stingJavaNet),在此表示感谢! 过滤器代码: public class EncodingFilter implements Filter { /** * The default character encoding to set for requests that pass through * this filter. */ protected String encoding = null; /** * The filter configuration object we are associated with. If this value * is null, this filter instance is not currently configured. */ protected FilterConfig filterConfig = null; /** * Should a character encoding specified by the client be ignored? */ protected boolean ignore = true; /** * Take this filter out of service. */ public void destroy() { this.encoding = null; this.filterConfig = null; } /** *选择并设置这个request要使用的字符编码 */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (ignore || (request.getCharacterEncoding() == null)) { String encoding = selectEncoding(request); if (encoding != null) { request.setCharacterEncoding(encoding); } } chain.doFilter(request, response); } /** *初始化过滤器参数 */ public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; this.encoding = filterConfig.getInitParameter("encoding"); String value = filterConfig.getInitParameter("ignore"); if (value == null) { this.ignore = true; } else if (value.equalsIgnoreCase("true")) { this.ignore = true; } else if (value.equalsIgnoreCase("yes")) { this.ignore = true; } else { this.ignore = false; } } /** *选择要使用的字符编码 */ protected String selectEncoding(ServletRequest request) { return (this.encoding); }}在web.xml中相应的配置
button.saveA2order=存A2定单
是经native2asc转换之前的内容。
过滤器代码:
public class EncodingFilter
implements Filter
{
/**
* The default character encoding to set for requests that pass through
* this filter.
*/
protected String encoding = null; /**
* The filter configuration object we are associated with. If this value
* is null, this filter instance is not currently configured.
*/
protected FilterConfig filterConfig = null; /**
* Should a character encoding specified by the client be ignored?
*/
protected boolean ignore = true; /**
* Take this filter out of service.
*/
public void destroy()
{
this.encoding = null;
this.filterConfig = null;
} /**
*选择并设置这个request要使用的字符编码
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException,
ServletException
{
if (ignore || (request.getCharacterEncoding() == null))
{
String encoding = selectEncoding(request);
if (encoding != null)
{
request.setCharacterEncoding(encoding);
}
}
chain.doFilter(request, response);
} /**
*初始化过滤器参数
*/
public void init(FilterConfig filterConfig) throws ServletException
{
this.filterConfig = filterConfig;
this.encoding = filterConfig.getInitParameter("encoding");
String value = filterConfig.getInitParameter("ignore");
if (value == null)
{
this.ignore = true;
}
else if (value.equalsIgnoreCase("true"))
{
this.ignore = true;
}
else if (value.equalsIgnoreCase("yes"))
{
this.ignore = true;
}
else
{
this.ignore = false;
}
} /**
*选择要使用的字符编码
*/
protected String selectEncoding(ServletRequest request)
{
return (this.encoding);
}}在web.xml中相应的配置