jsp中的空值问题 乱码问题!!! 急急急!
我的代码如下
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*"
errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%request.setCharacterEncoding("GBK");%>
<jsp:useBean id="con" scope="page" class="bean.Connect"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>部门管理</title>
</head>
<body bgcolor="#D2E4FC">
<%!
String sql="";
String key="";
String type="";
String id="";
String name="";
String adm="";
String ph="";
%>
<%
sql="select*from dept";
key= request.getParameter("mkey");
type= request.getParameter("mtype");
%>
<form action="department.jsp">
<div align="center">查询关键字:<input type="text" name="mkey"> 请选择查询字段:<select name="mtype">
<option value="depname">部门名称</option>
<option value="depch">部门负责人</option>
</select>
<input type="submit" value="查询">
<input type="button" value="添加部门" onclick="window.location.href='depadd.jsp'" />
</div>
</form>
<hr color="#9999FF">
<table width="90%" align="center" >
<tr bgcolor="" >
<td width="30%" align="center">部门</td>
<td width="20%" align="center">负责人</td>
<td width="30%" align="center">联系电话</td>
<td width="10%" align="center"></td>
<td width="10%" align="center"></td>
</tr>
</table>
<table width="90%" align="center" border="1">
<%
if(key!=null && !key.equals("") && type!=null && !type.equals(""))
{
sql+=" where "+ type +" like'%"+key+"%'";
}
ResultSet rs=con.executeQuery(sql);
while(rs.next())
{
id=rs.getString("depid");
name=rs.getString("depname");
adm=rs.getString("depch");
ph=rs.getString("depph");
if(ph.equals("")||ph==null)
{
ph="无";
}
%>
<tr>
<td width="30%" align="center"><div><%=name%></div></td>
<td width="20%" align="center"><div><%=adm%></div></td>
<td width="30%" align="center"><div><%=ph%></div></td>
<td width="10%" align="center"><div>修改</div></td>
<td width="10%" align="center"><div>删除</div></td>
</tr>
<%}
rs.close();%>
</table>
</body>
</html>
报错了
description
The server encountered an internal error () that prevented it from fulfilling this request.