javaweb运行时在程序编写页面出现如图所示的提示,错误在哪?如何修改?
<%@pagelanguage="java"import="java.util.*"pageEncoding="UTF-8"%><%@pageimport="java.s...
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%request.setCharacterEncoding("UTF-8"); %>
<html>
<head>
<title>修改后重写名片</title>
</head>
<body>
<%
String driverName="com.mysql.jdbc.Driver";// 驱动程序名
String url1="jdbc:mysql://127.0.0.1:3306/card";
String url2="?user=root&password=218908";
String url3="&useUnicode=true&characterEncoding=UTF-8";
String url=url1+url2+url3;// 形成带数据库读写编码的数据库连接字
Class.forName(driverName);// 加载并注册驱动程序
Connection conn=DriverManager.getConnection(url);// 创建连接对象
String sql="update card set name=?,position=?,phone=?,mailbox=?,address=? where name=? and position=?"; PreparedStatement pstmt=conn.prepareStatement(sql);
String name1=request.getParameter("name1");
String position1=request.getParameter("position1");
String phone=request.getParameter("phone");
String mailbox=request.getParameter("mailbox");
String address=request.getParameter("address");
String name=(String)session.getAttribute("name");
String position=(String)session.getAttribute("position");
pstmt.setString(1, name1); pstmt.setString(2, position1); pstmt.setString(3, phone); pstmt.setString(4, mailbox); pstmt.setString(5, address); pstmt.setString(6, name);pstmt.setString(7, position); int n=pstmt.executeUpdate();
if(n>=1){
out.print("重写数据库成功");}
else{
out.print("重写数据库失败");}
if(pstmt!=null){ pstmt.close();}
if(conn!=null){ conn.close();}
%>
</body>
</html> 展开
<%@ page import="java.sql.*" %>
<%request.setCharacterEncoding("UTF-8"); %>
<html>
<head>
<title>修改后重写名片</title>
</head>
<body>
<%
String driverName="com.mysql.jdbc.Driver";// 驱动程序名
String url1="jdbc:mysql://127.0.0.1:3306/card";
String url2="?user=root&password=218908";
String url3="&useUnicode=true&characterEncoding=UTF-8";
String url=url1+url2+url3;// 形成带数据库读写编码的数据库连接字
Class.forName(driverName);// 加载并注册驱动程序
Connection conn=DriverManager.getConnection(url);// 创建连接对象
String sql="update card set name=?,position=?,phone=?,mailbox=?,address=? where name=? and position=?"; PreparedStatement pstmt=conn.prepareStatement(sql);
String name1=request.getParameter("name1");
String position1=request.getParameter("position1");
String phone=request.getParameter("phone");
String mailbox=request.getParameter("mailbox");
String address=request.getParameter("address");
String name=(String)session.getAttribute("name");
String position=(String)session.getAttribute("position");
pstmt.setString(1, name1); pstmt.setString(2, position1); pstmt.setString(3, phone); pstmt.setString(4, mailbox); pstmt.setString(5, address); pstmt.setString(6, name);pstmt.setString(7, position); int n=pstmt.executeUpdate();
if(n>=1){
out.print("重写数据库成功");}
else{
out.print("重写数据库失败");}
if(pstmt!=null){ pstmt.close();}
if(conn!=null){ conn.close();}
%>
</body>
</html> 展开
3个回答
展开全部
你这是运行的断点模式,需要修改
“window”-"prefrences"-"myeclipse"-"Servers"-"Tomcat"-"Tomcat 6.x"-"Launch"-"Run mode"
引用自csdn: http://bbs.csdn.net/topics/210050301
“window”-"prefrences"-"myeclipse"-"Servers"-"Tomcat"-"Tomcat 6.x"-"Launch"-"Run mode"
引用自csdn: http://bbs.csdn.net/topics/210050301
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你启动的是调试模式吧?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询