求大神帮忙 ..这个原因说是数据库什么不匹配的 可是哪里不匹配啊 找了半天 找不出 ..
HTTP Status 500 - javax.servlet.ServletException: java.sql.SQLException: Column count doesn't match value count at row 1
type Exception report
message javax.servlet.ServletException: java.sql.SQLException: Column count doesn't match value count at row 1
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.sql.SQLException: Column count doesn't match value count at row 1
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
javax.servlet.ServletException: java.sql.SQLException: Column count doesn't match value count at row 1
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
org.apache.jsp.regAction_jsp._jspService(regAction_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
java.sql.SQLException: Column count doesn't match value count at row 1
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2409)
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2327)
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2312)
org.apache.jsp.regAction_jsp._jspService(regAction_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
==========================================================================
下面这个往数据库插入信息
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="include_head.jsp"%>
<%
//接收之前页面传递过来的URL参数
request.setCharacterEncoding("utf-8");
String username =request.getParameter("username");
String password =request.getParameter("password");
String name =request.getParameter("name");
String sex =request.getParameter("sex");
Connection conn=DBUtil.getConn();
PreparedStatement pstmt = DBUtil.getPstmt(conn,"insert into t_user values(null,?,?,?,?)");
pstmt.setString(1,username);
pstmt.setString(2,password);
pstmt.setString(3,name);
pstmt.setString(4,sex);
pstmt.executeUpdate();
%>
<jsp:forward page="index.jsp"></jsp:forward>
数据库 异常 Java String UTF-8
[解决办法]
呼呼 你数据表的第一个字段是不是count?然后你还用null去更新他出了问题撒
[解决办法]