现在的登陆界面我没有看见能用中文登陆的
请问问能不能有中文的支持呢?
代码是如何的呢?
我写的是string.equals(set1.getstring(2));
有了中文就不能通过
为什么呢?
应该怎么样的改呢
请大家帮忙
请问问能不能有中文的支持呢?
代码是如何的呢?
我写的是string.equals(set1.getstring(2));
有了中文就不能通过
为什么呢?
应该怎么样的改呢
请大家帮忙
调试欢乐多
/**
*
* Change Request Encoding
* @Author: Janner
* @Time: 2006-06-25
* @Version: 1.0
* @Copyright: Www.6428.Com Www.Jxva.Com Www.Jxva.Net Www.Jxva.Org
*
*/package com.jxva.framework.filter;import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;public class ChangeReqEncoding implements Filter
{
protected String encoding = null;
protected FilterConfig filterConfig = null;
protected boolean ignore = true; public void destroy()
{
this.encoding = null;
this.filterConfig = null;
} 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中加入
<filter>
<filter-name>Encoding</filter-name>
<filter-class>com.jxva.framework.filter.ChangeReqEncoding</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
<init-param>
<param-name>ignore</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Encoding</filter-name>
<servlet-name>action</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
加上这个应该没有问题吧,你试试!
转码一下就可以了
代码中如果还出先乱吗一样 request.setCharacterEncoding("gb2312");
来解决
请问问能不能有中文的支持呢?
代码是如何的呢?
我写的是string.equals(set1.getstring(2));
有了中文就不能通过
为什么呢?
应该怎么样的改呢
请大家帮忙
登陆肯定要去数据库中查表的
在request.getparameter()之前+ request.setchar...("gbk");
在用equals的方法 应该就可以比较中文了
或者用"gbk"
哈哈
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.sql.*" %>
<%
String name = request.getParameter("name");
String name_t1=new String(name.getBytes("ISO8859-1"));
out.print(name_t1);
%>
我看了一个论坛里面的东西弄好的
呵呵
谢谢大家帮忙!
欢迎高手加入!!!!!!!!!!!!!QQ群:
唯爱J2EE(java开发):14402276(人员已满)
唯爱J2EE(二群):15472518(人员已满)
唯爱J2EE(WEB):33308970(招人)
********************不要重复加入,谢谢**************************
此群只加J2EE方面的人才与高手...或搞JAVA 一年以上的.....其他人不加........加群时,,注明:J2EE方面的技术体系,,,如:Struts,Spring,Hibenate,EJB,JSF,Ajax,Oracle,Weblogic等有关技术,方能通过....