📄 searchpage.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>媒体素材库检索系统</title>
</head>
<body>
<form action="searchPage.jsp" method="post">
<input name="keyWord" type="text" id="keyWord">
<select name="multoType" id="multoType">
<option value="text">文本</option>
<option value="image">图像</option>
<option value="sound">声音</option>
<option value="video">视频</option>
<option value="animate">动画</option>
<option value="all">所有类型</option>
</select>
<input type="submit" name="Submit" value="搜索">
</form>
<table width="696" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000" style="border-collapse:collapse;font-size: 12px; ">
<tr>
<th width="75">学科类别</th> <th width="62">适用对象</th><th width="128">内容简介</th><th width="87">编写时间</th>
<th width="88">素材编著者</th><th width="81">素材的大小</th><th width="60">文件格式</th><th width="65">下载地址</th>
</tr>
<%
if(request.getParameter("keyWord")!=null && request.getParameter("multoType")!=null)
{
String getKeyWord=request.getParameter("keyWord");
getKeyWord=new String(getKeyWord.getBytes("ISO8859-1"));
String getMultiType=request.getParameter("multoType");
getMultiType=new String(getMultiType.getBytes("ISO8859-1"));
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection cnn=DriverManager.getConnection("jdbc:mysql://localhost/multimedia?useUnicode=true&characterEncoding=gb2312","root","");
Statement stm=cnn.createStatement();
String sql = "select * from "+getMultiType+" where KeyWords Like '%"+getKeyWord+"%'";
ResultSet rs = stm.executeQuery(sql);
while(rs.next())
{
out.println("<tr>");
out.println("<td>"+rs.getString("SubjectType")+"</td> ");
out.println("<td>"+rs.getString("ObjectType")+"</td> ");
out.println("<td>"+rs.getString("Description")+"</td> ");
out.println("<td>"+rs.getString("WriteTime")+"</td> ");
out.println("<td>"+rs.getString("Writer")+"</td> ");
out.println("<td>"+rs.getString("Size")+"k</td> ");
out.println("<td>"+rs.getString("FileType")+"</td> ");
out.println("<td><a href="+rs.getString("SavePath")+">下载</a></td> ");
out.println("</tr> ");
}
}
catch(Exception e)
{
out.println(e.toString());
}
}
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -