search.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.*"%>
<jsp:useBean id="search" class="Bean.DbConn" scope="page"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
	request.setCharacterEncoding("GBK");
	int brand_id=Integer.parseInt(request.getParameter("brand"));
	String type=request.getParameter("type");
	String str="select car_id from car where brand_id="+brand_id+" and type='"+type+"'";
	String str1="select car_id from ";
	ResultSet rs=null;
	search.open();
	rs=search.executeQuery(str);
	
	if(rs!=null)
	{
		if(rs.next())
			{
				response.sendRedirect("CarInfo.jsp?car_id="+rs.getInt(1));
			}
	}
%>
</body>
</html>

⌨️ 快捷键说明

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