当前页面: 开发资料首页 → Eclipse 专题 → 關于jsp中變量類型轉換,在線等................................
關于jsp中變量類型轉換,在線等................................
摘要: 關于jsp中變量類型轉換,在線等................................
25 String nickName=request.getParameter("nickName");
26 byte [] tmpbyte = nickName.getBytes("ISO-8859-1");
27 nickName=new String(tmpbyte);
28 //查找提交的用戶名是否存在
29 String sql="select * from chatuser where nickName like '"+nickName+"'";
30 ResultSet rs=jspEx.executeQuery(sql);
為什么出現錯誤:
org.apache.jasper.JasperException: Exception in JSP: /login.jsp:26
25 String nickName=request.getParameter("nickName");
26 String tmpbyte = nickName.getBytes("ISO-8859-1");
27 nickName=new String(tmpbyte);
28 //查找提交的用戶名是否存在
29 String sql="select * from chatuser where nickName like '"+nickName+"'";
30 ResultSet rs=jspEx.executeQuery(sql);
贴多些看看
String str = new String();
String StrUTF8= new String( str.getBytes("该字符串的编码"), "要转换的编码") ;