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

📄 list.jsp

📁 这是一个简单的用B/S写的留言板小程序,用jsp和javaBean实现的
💻 JSP
字号:
 <%@ page contentType="text/html;charset=gb2312"%>
 <%@ page import="note1.*"%>
 <%@ page import="java.util.*"%>
 <%@ page import="person1.*"%>
 <%@ page import="login1.*"%>
<html>
<head>
	<title>JSP+DAO 留言管理程序——登陆</title>
</head>
<body>
<center>
	<h1>留言管理范例 —— JSP + DAO实现</h1>
	<hr>
	<br>
	<%
	   int i=0;
	   String str1=(String)request.getParameter("name1");
	   List all=null;
	   if(str1==null)
	   {
	     all=personFactory.getnoteDAoinstance().findall();
	   }
	  else
	  	{
	  	  all=personFactory.getnoteDAoinstance().findbylike(str1);
	  	}
	%>
	<form action="list.jsp" method="post">
		请输入查询内容:<input type="text" name="name1">
		<input type="submit" value="查询">
	</form>
	<a href="add.jsp">添加新留言</a>
	<table width="80%" border="1">
	<tr>
		<td>留言ID</td>
		<td>标题</td>
		<td>作者</td>
		<td>内容</td>
		<td>删除</td>
	</tr>
	<%
	 Iterator iter=all.iterator();
	 while(iter.hasNext())
	 {
	  note note=(note)iter.next();
	  i++;
	  int id=note.getid();
	  String title=note.gettitle();
	  String author=note.getauthor();
	  String content=note.getcontent();
	  if(str1!=null)
	  {
	     title = title.replaceAll(str1,"<font color=\"red\">"+str1+"</font>") ;
			 author = author.replaceAll(str1,"<font color=\"red\">"+str1+"</font>") ;
			 content = content.replaceAll(str1,"<font color=\"red\">"+str1+"</font>") ;
	  }
	  %>
	  <tr>
	  	<td><%=id%></td>
	  	<td><a href=update.jsp?id=<%=id%>><%=title%></a></td>
	  	<td><%=author%></td>
	  	<td><%=content%></td>	
	  	<td><a href=delete.jsp?id=<%=id%>>删除</a></td>	
	  	<%
	  	if(i==0)
	  	{
	  	%>
	  	 <tr>
	  	 	<td colspan="5">没有任何内容</td>
	  	</tr>
	  	<%
	 }
	 }
	%>
	</table>
</center>
</body>
</html>

⌨️ 快捷键说明

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