⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delete_list.jsp

📁 JSP的一个DEMO程序
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" %> 
<%@ page import="java.sql.*" %>
<%!
  Connection conn;
  java.sql.Statement stmt;
  ResultSet Rs;
  String strSQL="";
%>
<%!
public String chstr(String str){  
   try{
     String temp_p=str;
     if(temp_p==null){temp_p="";}
     byte[] temp_t=temp_p.getBytes("ISO-8859-1");
	   String temp=new String(temp_t);	 
	   return temp;
	 }catch(Exception e){
	   return null;
	 }	
}
%>
<html>
<body>
<%
String strDate="";
try{ 
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  conn=DriverManager.getConnection("jdbc:odbc:quiz","",""); 
  stmt=conn.createStatement();
  strSQL="select cstr(d_date) as s_date,s_topic from T_RECORD where 1>0 ";
  if(!request.getParameter("s_date_begin").equals(""))
      strSQL+=" and d_date>=#"+request.getParameter("s_date_begin")+"#";
  if(!request.getParameter("s_date_end").equals(""))
      strSQL+=" and d_date>=#"+request.getParameter("s_date_end")+"#";
  if(!chstr(request.getParameter("s_topic")).equals(""))
      strSQL+=" and s_topic='"+chstr(request.getParameter("s_topic"))+"'";
  //out.print(strSQL); 
  Rs=stmt.executeQuery(strSQL);
} catch(Exception e){
  out.println(e.getMessage());
} 
%>
<table border="1">
  <tr>
   <td colspan="2" align="center">我的日记显示</td>
  </tr>
  <tr>
   <td align="center">日期</td>
   <td align="center">标题</td>
  </tr>
  <%while(Rs.next()){
    strDate=Rs.getString("s_date"); //注意,下面因为要用到两次,不能连续读取两次,所以这里设置变量。
  %>
  <tr>
  	<td><a href="delete_detail.jsp?s_date=<%=strDate%>"><%=strDate%></a></td>
  	<td><%=Rs.getString("s_topic")%></td>
  </tr>
   <%}%>
</table>
</body>
</html>   	   

⌨️ 快捷键说明

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