42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
<%@ 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="reg" class="com.DB" scope="page" />
|
|
<jsp:useBean id="times" class="com.Shijian" scope="page" />
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
|
|
<title>Insert title here</title>
|
|
</head>
|
|
<body>
|
|
<%
|
|
try {
|
|
String username=new String(request.getParameter("username").getBytes("ISO-8859-1"),"GB18030");
|
|
String chepaihao=new String(request.getParameter("chepaihao").getBytes("ISO-8859-1"),"GB18030");
|
|
String states=new String(request.getParameter("states").getBytes("ISO-8859-1"),"GB18030");
|
|
String shuoming=new String(request.getParameter("shuoming").getBytes("ISO-8859-1"),"GB18030");
|
|
|
|
Connection con=reg.getCon();
|
|
String sqlt="select * from weigui where chepaihao='"+chepaihao+"'";
|
|
ResultSet rs=reg.GetRs(sqlt);
|
|
|
|
if(rs.next()){
|
|
out.println("<script lanage='javascript'>alert('车牌号已被录入');javascript:history.go(-1);</script>");
|
|
}
|
|
else
|
|
{
|
|
// 添加信息的SQL语句
|
|
String sql = "insert into weigui(username,chepaihao,states,shuoming) values('"+username+"','"+chepaihao+"','"+states+"','"+shuoming+"')";
|
|
int row = reg.GetCount(sql);
|
|
|
|
if(row > 0){
|
|
out.println("<script>alert('违规添加成功!');window.location.href='weigui_mg.jsp';</script>");
|
|
}
|
|
con.close();}
|
|
} catch (Exception e) {
|
|
out.print("违规添加失败!");
|
|
e.printStackTrace();
|
|
}
|
|
%>
|
|
</body>
|
|
</html> |