Servlet execution threw an exception
程序启动正常,打开a页面,提交一个form表单到后台处理,跳到成功页面,成功页面有个button是跳到a页面,此时就报错。
2011-10-18 14:24:23 org.apache.catalina.core.ApplicationContext log
信息: Servlet execution threw an exception
-----------------------下面是action---------------------------
package zzb;
import java.sql.Connection;
import java.sql.ResultSet;
import
java.sql.SQLException;
import java.sql.Statement;
import jsoft.common.service.ServiceContext;
import jsoft.common.service.db.DbService;
import jsoft.face.context.FaceContext;
public class zzbAction {
private static DbService dbService;
static{
dbService = (DbService) ServiceContext.getInstance().getService(DbService.DB_SERVICE_ID);
dbService.addClassMapping(Zzb.class);
}
Connection con = dbService.getJDBCConnection();
public String zzbEvent(FaceContext faceContext)
{
int number=0;
String msg = "保存";
String y = faceContext.getParameter("y");
String m = faceContext.getParameter("m");
String d = faceContext.getParameter("d");
String w = faceContext.getParameter("w");
String dbld = null;
String zbry = null;
System.out.println(y+"年"+m+"月"+d+"日第"+w+"周");
int d1 = Integer.parseInt(d);
Statement stat = null;
ResultSet result = null;
String sql1="SELECT * FROM t_zbpb_zzb1 WHERE id="+y+w;
try {
stat = con.createStatement();
result = stat.executeQuery(sql1);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(sql1);
try {
if (result.next()) {//如果数据库中已经有此列就进行更新操作
for(int i=1;i<8;i++){
dbld = faceContext.getParameter("dbld"+i);
zbry = faceContext.getParameter("zbry"+i);
String sql3 = "update t_zbpb_zzb1 set dbld='"+dbld+"',zbry='"+zbry+"' where pbn='"+y+"' and pby='"+m+"' and pbr='"+d1+"'";
System.out.println(sql3);
number=stat.executeUpdate(sql3);
msg = "更新";
d1++;
}
}
else {
for(int i=1;i<8;i++){
dbld = faceContext.getParameter("dbld"+i);
zbry = faceContext.getParameter("zbry"+i);
stat = con.createStatement();
String sql2="insert into t_zbpb_zzb1(id,pbn,pby,pbr,pbz,dbld,zbry) values("+y+w+",'"+y+"','"+m+"','"+d1+"','"+w+"','"+dbld+"','"+zbry+"')";
System.out.println(sql2);
number=stat.executeUpdate(sql2);
msg = "保存";
d1++;
}
}
} catch (Exception e) {
e.printStackTrace();
}
//System.out.println("dbld:"+dbld+" zbry:"+zbry);
try {
result.close();
con.close();
} catch (
SQLException e) {
e.printStackTrace();
}
faceContext.getRequest().getSession().setAttribute("msg", msg);
System.out.println(faceContext.getRequest().getSession().getAttribute("msg"));
if (number>0) return "success";
else return "error";
}
}
请问这是什么原因,网上说可能jvm太小,我设置大了还是不行。
------解决方案--------------------
up----
我的异常网推荐解决方案:Servlet.service() for servlet default threw exception,http://www.myexception.cn/eclipse/181756.html