JAVAEE-based-parking-manage.../tingchechang/WebContent/admin/chewei_chuli.jsp

57 lines
1.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030" import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="db" class="com.DB" scope="page" />
<jsp:useBean id="encoding" class="com.Char" />
<jsp:useBean id="popDialog" class="com.Dialog" />
<jsp:useBean id="chwei" class="com.edit.Chewei" />
<jsp:useBean id="shijian" class="com.Shijian" />
<jsp:setProperty property="*" name="chwei" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>
<%
try {
String chewei_no=encoding.toString(request.getParameter("chewei_no"));
String chewei_type=encoding.toString(request.getParameter("chewei_type"));
String chewei_state=encoding.toString(request.getParameter("chewei_state"));
String chewei_didian=encoding.toString(request.getParameter("chewei_didian"));
Connection conn=db.getCon();
// 添加图书信息的SQL语句
String sql = "insert into chewei(chewei_no,chewei_type,chewei_state,chewei_didian)values(?,?,?,?)";
// 获取PreparedStatement
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1,encoding.toString(chwei.getChewei_no()));
ps.setString(2,encoding.toString(chwei.getChewei_type()));
ps.setString(3,encoding.toString(chwei.getChewei_state()));
ps.setString(4,encoding.toString(chwei.getChewei_didian()));
int row = ps.executeUpdate();
// 判断是否更新成功
if(row > 0){
out.println(popDialog.messageBox("车位添加成功!","chewei_mg.jsp"));
}
// 关闭PreparedStatement释放资源
ps.close();
// 关闭Connection释放资源
conn.close();
} catch (Exception e) {
out.print("车位添加失败!");
e.printStackTrace();
}
%>
</body>
</html>