jsp问题如何解决?!
来源:互联网 发布:梁朝伟 帅 知乎 编辑:程序博客网 时间:2024/04/28 07:20
老师让做一个小型的个人理财系统,用这学期学的jsp做。因为项目比较小,所以我用jsp+javabean.
前面分析的都很顺利,到后面的时候就出问题了,报了个这样的错误。强行关闭我的tomcat。
- #
- # An unexpected error has been detected by Java Runtime Environment:
- #
- # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c92100b, pid=2360, tid=1300
- #
- # Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode windows-x86)
- # Problematic frame:
- # C [ntdll.dll+0x100b]
- #
- # An error report file with more information is saved as:
- # D:/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_8.5.0.me201003121946/tomcat/bin/hs_err_pid2360.log
- #
- # If you would like to submit a bug report, please visit:
- # http://java.sun.com/webapps/bugreport/crash.jsp
- # The crash happened outside the Java Virtual Machine in native code.
- # See problematic frame for where to report the bug.
- #
有关的代码是这样的:
1.数据库操作类
- /**
- * 操作支出表的实体bean
- */
- package com.hb.Dao;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- /**
- * @author icecold
- *
- */
- public class OutDao {
- java.sql.Connection conn = null;
- java.sql.PreparedStatement ps = null;
- java.sql.ResultSet rs = null;
- java.sql.Statement stmt = null;
- String sql = "";
- /*
- * 判断是否存在重复id
- */
- public boolean isOutExist(String id){
- conn=DatabaseUtil.getConnection();
- String sql="select *from out where id=?";
- try{
- PreparedStatement ps=conn.prepareStatement(sql);
- ps.setString(1, id);
- ResultSet rs=ps.executeQuery();
- if(rs.next()){
- //此id重复
- return true;
- }
- rs.close();
- ps.close();
- }catch(Exception e){
- e.printStackTrace();
- }finally{
- DatabaseUtil.closeConnection(conn);
- }
- return false;
- }
- /*
- * 增加记录
- */
- public boolean insertOut(String id, String name, String type,
- java.sql.Date date, double money, String beizhu) {
- boolean flag = false;
- int n = 0;
- sql = "insert into out values(?,?,?,?,?,?)";
- try {
- ps = conn.prepareStatement(sql);
- ps.setString(1, id);
- ps.setString(2, name);
- ps.setString(3, type);
- ps.setDate(4, date);
- ps.setDouble(5, money);
- ps.setString(6, beizhu);
- n = ps.executeUpdate();
- if (n > 0) {
- flag = true;
- } else {
- flag = false;
- }
- ps.close();
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- conn.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return flag;
- }
- }
2、调用Javabean操作数据库的jsp文件代码:
- if (outDao.isOutExist(id)) {
- out.println("<script language='javascript'>alert('此编号已存在,请更换后添加!');</script>");
- } else {
- //if(outDao.insertOut(myOut.getId(),myOut.getName(),myOut.getType(),myOut.getDate(),myOut.getMoney(),myOut.getBeizhu())){
- response.sendRedirect("outMan.jsp");
- //}
- }
上面的代码,我必须按照上面的那样把那两行注释掉,才能不强行关闭我的tomcat,网上搜了下,有人说是数据库操作的问题,暂时认为这个问题应该出在isOutExist和insertOut两个之间。
求高手!!!
- jsp问题如何解决?!
- 如何解决JSP页面显示乱码问题!!
- 如何解决JSP页面显示乱码问题
- 如何解决JSP页面显示乱码问题
- 如何解决JSP页面乱码问题
- 如何解决JSP页面显示乱码问题
- 如何解决JSP中文乱码问题
- 如何解决JSP中文乱码问题
- 如何解决JSP页面显示乱码问题
- tomcat+jsp不支持中文显示问题如何解决
- 如何解决jsp中button按钮的超连接问题!
- tomcat+jsp不支持中文显示问题如何解决
- 【ZT】如何解决JSP页面、JDBC显示乱码问题
- jsp中如何解决中文乱码的问题
- 如何解决jsp+mysql出现的中文乱码问题
- 如何解决JSP表格提交中文乱码问题:
- jsp的中文乱码问题如何/怎么解决 解决JSP中文乱码问题. 有两种方法可解决
- 解决jsp乱码问题
- 盒饭故意
- 64位windows7系统下安装phpnow出现“安装服务 [ Apache_pn ] 失败”的解决办法
- C++中关于冒泡排序的算法代码
- create table xx.sql
- 数据结构 深度优先 迷宫问题代码
- jsp问题如何解决?!
- fedora下新版本jdk安装问题
- 大四了,感慨下。
- 在路上
- 越来越觉的压力大。
- 加油
- 天气变冷了。。
- 今天开始新旅程
- 第一篇