下面是一个更改信息的程序,提交更改后的信息以后,就会报错:org.apache.jasper.JasperException java.lang.NullPointerException
搞了很久了,不知道为什么~~~
很急很急~~~ 大侠们帮帮忙哦!!!
<%@ page language = "java" contentType = "text/html;charset=gb2312"%>
<%@ page import = "java.sql.*" %>
<jsp:useBean id = "sts" scope = "page" class = "sts.JdbcOdbc_Con" />
<%!
public String codeToString(String str)
{//处理中文字符串的函数
String s=str;
try
{
byte tempB[]=s.getBytes("ISO-8859-1");
s=new String(tempB);
return s;
}
catch(Exception e)
{
return s;
}
}
%>
<% String name1= (String) session.getValue("name1");
if((name1==null)|(name1=="")){
out.print("<SCRIPT language=JavaScript>alert('操作超时,请重新登录!');");
out.print("this.location.href='../default.jsp';</SCRIPT>");
}
%>
<%!
String replacenull(String a){
if(a==null){
return "";
}else{
return a;
}
}
String selected(String a,String b){
if(a==null){
return "";
}
if(a.equals(b)){
return "selected";
}else{
return "";
}
}
%>
<%
String meeting_id =request.getParameter("meeting_id");
String userName= (String) session.getValue("name1");
String sqlname;
sqlname="select * from meeting where meeting_id='"+meeting_id+"' " ;
ResultSet rs=sts.executeQuery(sqlname);
if(rs.next()){
%>
<html> html代码省略 </html>
<%
String memo=codeToString(request.getParameter("memo"));
if(memo!=null){
String meeting_name=codeToString(request.getParameter("meeting_name"));
if(meeting_name==null)//无内容则设为空串
meeting_name="";
String category=codeToString(request.getParameter("category"));
if(category==null)//无内容则设为空串
category="";
String start_time=codeToString(request.getParameter("start_time"));
if(start_time==null)//无内容则设为空串
start_time="";
String place=codeToString(request.getParameter("place"));
if(place==null)//无内容则设为空串
place="";
String receiver=codeToString(request.getParameter("receiver"));
if(receiver==null)//无内容则设为空串
receiver="";
String contactor_name=codeToString(request.getParameter("contactor_name"));
if(contactor_name==null)//无内容则设为空串
contactor_name="";
String contactor_tel=codeToString(request.getParameter("contactor_tel"));
if(contactor_tel==null)//无内容则设为空串
contactor_tel="";
String contactor_email=codeToString(request.getParameter("contactor_email"));
if(contactor_email==null)//无内容则设为空串
contactor_email="";
sts.executeUpdate("update meeting set meeting_name='"+meeting_name+"',category='"+category+"',start_time='"+start_time+"',place='"+place+"',receiver='"+receiver+"' ,memo='"+memo+"' ,contactor_name='"+contactor_name+"',contactor_tel='"+contactor_tel+"' , contactor_email='"+contactor_email+"' where meeting_id='"+meeting_id+"'");