sendcomment.jsp

来自「汽车展销的网站开发」· JSP 代码 · 共 32 行

JSP
32
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=gb2312"
    pageEncoding="gb2312" import="java.sql.*,java.util.Date"%>
	<jsp:useBean id="send" class="Bean.DbConn" scope="request"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
		java.util.Date now = new java.util.Date();
	java.sql.Date today= new java.sql.Date(now.getYear(),now.getMonth(),now.getDate());
	/**String year = String.valueOf(now.getYear()+1900);
	String month =String.valueOf(now.getMonth()+1);
	String day = String.valueOf(now.getDate());
	String time=year+"-"+month+"-"+day;*/
		send.open();
		int car_id=Integer.parseInt(request.getParameter("car_id"));
		String user_content=request.getParameter("comment");
		String comment="insert into comment(car_id,user_name,content,comment_time) values("+car_id+",'"+(String)session.getAttribute("user")+"','"+user_content+"','"+today+"')";
		int intContent=send.executeUpdate(comment);
		if(intContent!=0)
			out.println("<script>alert('发表成功!');window.history.go(-1);</script>");
		

%>

</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?