JAVAEE-based-parking-manage.../tingchechang/WebContent/huiyuan/h_zhifu_chuli.jsp

60 lines
2.0 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="zhifu" class="com.edit.Zhifu" />
<jsp:useBean id="shijian" class="com.Shijian" />
<jsp:setProperty property="*" name="zhifu" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>
<%
try {
String username=encoding.toString(request.getParameter("username"));
String yonghu_type=encoding.toString(request.getParameter("yonghu_type"));
String zhifu_type=encoding.toString(request.getParameter("zhifu_type"));
String jine=encoding.toString(request.getParameter("jine"));
String beizhu=encoding.toString(request.getParameter("beizhu"));
Connection conn=db.getCon();
// 添加图书信息的SQL语句
String sql = "insert into feiyong(username,yonghu_type,zhifu_type,jine,beizhu,shijian)values(?,?,?,?,?,'"+shijian.showTodayTime()+"')";
// 获取PreparedStatement
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1,encoding.toString(zhifu.getUsername()));
ps.setString(2,encoding.toString(zhifu.getYonghu_type()));
ps.setString(3,encoding.toString(zhifu.getZhifu_type()));
ps.setString(4,encoding.toString(zhifu.getJine()));
ps.setString(5,encoding.toString(zhifu.getBeizhu()));
int row = ps.executeUpdate();
// 判断是否更新成功
if(row > 0){
out.println(popDialog.messageBox("支付添加成功!","huiyuan_zhifu.jsp"));
}
// 关闭PreparedStatement释放资源
ps.close();
// 关闭Connection释放资源
conn.close();
} catch (Exception e) {
out.print("支付添加失败!");
e.printStackTrace();
}
%>
</body>
</html>