">
时间:2021-07-01 10:21:17 帮助过:33人阅读
myeclipse下的web应用
有一个登录注册功能,登陆的时候读取数据库可以,
但是注册要写入进去就不行
register.jsp <%@ page language="java" import="java.util.*,java.sql.*,cn.edu.dhu.*"%><%@ page contentType="text/html,charset=utf-8" pageEncoding="utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%> <% String name = request.getParameter("usernamesignup"); String account = request.getParameter("emailsignup"); String pswd1 = request.getParameter("passwordsignup"); String pswd2 = request.getParameter("passwordsignup_confirm"); System.out.println("name="+name); System.out.println("name="+account); System.out.println("name="+pswd1); System.out.println("name="+pswd2); if(account !=null && pswd2!=null){ System.out.println("执行到了"); String sql = "use jsgl;insert into jsgl.user values('"+name+"','"+account+"','"+pswd1+"','"+pswd2+"')"; System.out.println("执行到了"); Connection conn=DB.getConn(); System.out.println("执行到了"); Statement stmt = DB.createStmt(conn); System.out.println("执行到了"); int n = DB.executeUpdate(stmt, sql); response.sendRedirect("index.jsp"); System.out.println("执行到了"); } %>
都执行到了,但是数据库里面没有信息
ps:从命令行敲insert语句是可以插入的 myeclipse这里不行的
求帮忙