怪,为什么明明是空却识别不是空?
下面这段代码为什么每次打印的都是“feikong”?
我的提交页面是:http://cn:8080/duanx/test02010.jsp?chanel=
也就是说我实际上没有传递参数给chanel.
<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.io.*"%>
<%@ page import="java.sql.*"%>
<jsp:useBean id="jk" scope="page" class="jk100.dbconn"/>
<%!
public String ConvertStr(String sStr) {
String sRtn = "";
if (sStr == null) {
sRtn = "";
} else {
try
{
sRtn = new String(sStr.getBytes("ISO-8859-1"), "GBK");
}
catch(Exception ex)
{
sRtn="";
}
}
return sRtn;
}
%>
<% ResultSet rs;
String sql_count;
String chanel;
chanel=ConvertStr(request.getParameter("chanel"));
if(chanel==""||chanel==null)
{
sql_count="select * from tbl_titles";
out.println("kong");
}
else
{
sql_count="select * from tbl_titles where chanel = '"+ chanel + "'";
out.println("feikong");
}
%>