jsp+javabean时插入取日期数据出错
我写jsp时日期用SimpleDateFormat,用其format(date)格式化日期,但是输出结果不对,如图还有我用的是access数据库,导出的数据也不对,图,代码如下
代码:
java.sql.Date check_date;
String user_name;
String check_op;
int check_id;
String check_zy;
String check_list;
int c_type;
String c_input;
check_date = java.sql.Date.valueOf(request.getParameter("check_date"));
user_name = trans(request.getParameter("user_name"));
check_op = trans(request.getParameter("check_op"));
check_id = Integer.parseInt(request.getParameter("check_id"));
check_zy = trans(request.getParameter("check_zy"));
check_list = trans(request.getParameter("check_list"));
c_type=Integer.parseInt(request.getParameter("c_type"));
c_input=request.getParameter("c_input");
try{
PreparedStatement ps = con2.getPs("insert into szkz(check_date,username,check_op,check_id,check_zy,check_list,c_type,c_input) values('"+check_date+"',?,?,?,?,?,?,?)");
ps.setString(1,user_name);
ps.setString(2,check_op);
ps.setInt(3,check_id);
ps.setString(4,check_zy);
ps.setString(5,check_list);
ps.setInt(6,c_type);
ps.setString(7,c_input);
ps.executeUpdate();
con2.close();
}catch(SQLException se){
se.printStackTrace();
out.println("<script language='javascript'>alert('插入数据有误,请重新插入');window.location.href='lian.jsp';</script>");
}
怎么回事啊