• 十天冲刺(7)


    昨天的任务:做管理员功能主界面;里边可以做到普通用户账号的删除,同样可以进行失物招令等功能。

    存在的问题;需要管理员动手操作删除,无法实现自动识别不良信息,系统自动删除表单功能,这里简单的思路是运用之前做过的项目:查询英文文章单词个数,去掉常用词汇。但是不良表单里信息会避开这些敏感词汇,从而无法实现自动删除不良表单。

    今天的任务:管理员删除表单的功能:对于发布不良信息的表单,管理员有删除其发布寻物表单,或者失物招领表单。

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
        <%@ page import="java.sql.*" %>
    <jsp:useBean id="dao" class="Dao.Dao" scope="page"/>
    <!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=UTF-8">
    <link rel="stylesheet" href="css/style1.css" type="text/css" media="all" />
    <title>失物信息管理</title>
    <style> 
            .black_overlay{ 
                display: none; 
                position: absolute; 
                top: 0%; 
                left: 0%; 
                 100%; 
                height: 100%; 
                background-color: black; 
                z-index:1001; 
                -moz-opacity: 0.8; 
                opacity:.80; 
                filter: alpha(opacity=88); 
            } 
            .white_content { 
                display: none; 
                position: absolute; 
                top: 25%; 
                left: 25%; 
                 55%; 
                height: 55%; 
                padding: 20px; 
                border: 10px solid orange; 
                background-color: white; 
                z-index:1002; 
                overflow: auto; 
            } 
        </style> 
    </head>
    <body>
    <%
    if(session.getAttribute("userName")==null)
    {
    	response.sendRedirect("jiemian.jsp");
    }
    %>
    <%
    	     Object message = request.getAttribute("message");//放置一个字符串,并取出
    	     if(message!=null && !"".equals(message)){
    	 
    	%>
    	     <script type="text/javascript">
    	          alert("<%=request.getAttribute("message")%>");
    	     </script>
    <%} %>
    <!-- Header -->
    <div id="header">
    	<div class="shell">
    		<!-- Logo + Top Nav -->
    		<div id="top">
    			<h1><a href="#">管理员界面</a></h1>
    			<div id="top-navigation">
    				欢迎 <a href="#"><strong>管理员</strong></a>
    				<span>|</span>
    				<a href="#">帮助</a>
    				<span>|</span>
    				<a href="index.jsp">退出</a>
    				<span>|</span>
    			</div>
    		</div>
    		<!-- End Logo + Top Nav -->
    		
    		<!-- Main Nav -->
    		<div id="navigation">
    			<ul>
    			    <li><a href="managerds.jsp" class="active"><span>失物信息管理</span></a></li>
    			    <li><a href="managerjd.jsp"><span>招领信息管理</span></a></li>
    			    <li><a href="usermanager.jsp"><span>用户管理</span></a></li>
    			    
    			</ul>
    		</div>
    		<!-- End Main Nav -->
    	</div>
    </div>
    <!-- End Header -->
    
    <!-- Container -->
    <div id="container">
    	<div class="shell">
    		
    		<!-- Small Nav -->
    		
    		<!-- End Small Nav -->
    		
    		<!-- Message OK -->		
    		<!--
    		<div class="msg msg-ok">
    			<p><strong>Your file was uploaded succesifully!</strong></p>
    			<a href="#" class="close">close</a>
    		</div> --> 
    		<!-- End Message OK -->		
    		
    		<!-- Message Error -->
    		<!--
    		<div class="msg msg-error">
    			<p><strong>You must select a file to upload first!</strong></p>
    			<a href="#" class="close">close</a>
    		</div>  -->
    		
    		
    		<!-- End Message Error -->
    		<br />
    		<!-- Main -->
    		<div id="main">
    			<div class="cl"> </div>
    			
    			<!-- Content -->
    			<div id="content">
    				
    				<!-- Box -->
    				<div class="box">
    					<!-- Box Head -->
    					<form action="searchdsByuserName.jsp" method="post">
    					<div class="box-head">
    						<h2 class="left">失物信息列表</h2>
    						
    						<div class="right">
    							<input type="text" name="userName"   class="field small-field" />
    							<input type="submit" class="button" value="查询" />
    						</div>
    						
    					</div>
    					</form>
    					<!-- End Box Head -->	
    
    					<!-- Table -->
    					<form action="addServlet?method=deleteds" method="post">
    					<div class="table">
    						<table width="100%" border="0" cellspacing="0" cellpadding="0">
    							<tr>
    								<th width="13"> </th>
    								<th>发布人</th>
    								<th>物品类别</th>
    								<th>丢失地点</th>
    								<th>丢失时间</th>
    								<th>联系方式</th>
    								<th>详细信息</th>
    								<th width="110" class="ac">操作</th>
    							</tr>
    							<%
            ResultSet rs=dao.listAllds();
    		int dsnumber = 1;
    		
    		
    		 
    		
          if(rs==null){
        	  %>
              <tr align="center" valign="middle"><td colspan="4">没有记录显示!</td>
              </tr>
              <%
           }
          else{
        	  
    		while(rs.next()){%>
    							<tr>
    								<td><input type="checkbox" class="checkbox" name="checkds" value="<%=rs.getInt("id") %>" /></td>
    								<td><h2><%=rs.getString("userName") %></h2></td>
    								<td><h3><%=rs.getString("name") %></h3></td>
    								<td><%=rs.getString("place") %></td>
    								<td><%=rs.getString("time") %></td>
    								<td><%=rs.getString("people") %></td>
    								<td><%=rs.getString("info") %></td>
    								
    								<td><a onclick="return check()" href="deleteds.jsp?id=<%=rs.getInt("id") %>" class="ico del">删除</a><a href="updateds.jsp?id=<%=rs.getInt("id") %>" class="ico edit">修改</a></td>
    							</tr>
    							<%
    							dsnumber++;}
    							}%>
    							
    						</table>
    						</div>
    		<script type="text/javascript">
    		function check() {
    			if (confirm("确定删除吗?")){
    				return true;
    			}else{
    				return false;
    			}
    		}
    	</script>				
    						
    						<!-- Pagging -->
    						<div class="pagging">
    							<div class="left">1-<%=dsnumber-1 %></div>
    							<div class="left">
    							 		<input type="submit"onclick="return check()" class="button" value="删除所选内容" />
    							 		</div></div>
    						    </form>
    						   
    							<div class="right">
    								<a href="#">前一页</a>
    								<a href="#">1</a>
    								<a href="#">2</a>
    								<a href="#">3</a>
    								<a href="#">4</a>
    								<span>...</span>
    								<a href="#">下一页</a>
    							</div>
    						</div>
    						</div>
    						<!-- End Pagging -->
    						
    					</div>
    					<!-- Table -->
    					
    				</div>
    				<!-- End Box -->
    				
    				<!-- Box -->
    				<div class="box">
    					<!-- Box Head -->
    					<div class="box-head">
    						<h2>添加备注记录</h2>
    					</div>
    					<!-- End Box Head -->
    					
    					<form action="" method="post">
    						
    						<!-- Form -->
    						<div class="form">
    								<p>
    									<span class="req">100字以内</span>
    									<label>备注主题<span>(必填)</span></label>
    									<input type="text" class="field size1" />
    								</p>	
    								<p class="inline-field">
    									<label>日期</label>
    									<input type="datetime-local" class="field size1" name="date">
    								</p>
    								
    								<p>
    									<span class="req">1000以内</span>
    									<label>备注内容 <span>(必填)</span></label>
    									<textarea class="field size1" rows="10" cols="30"></textarea>
    								</p>	
    							
    						</div>
    						<!-- End Form -->
    						
    						<!-- Form Buttons -->
    						<div class="buttons">
    							<input type="submit" class="button" value="提交" />
    						</div>
    						<!-- End Form Buttons -->
    					</form>
    				</div>
    				<!-- End Box -->
    
    			</div>
    			<!-- End Content -->
    			
    			<!-- Sidebar -->
    			<div id="sidebar">
    				
    				<!-- Box -->
    				<div class="box">
    					
    					<!-- Box Head -->
    					<div class="box-head">
    						<h2>管理</h2>
    					</div>
    					<!-- End Box Head-->
    					
    					<div class="box-content">
    						
    						<div class="cl"> </div>
    						
    						<p class="select-all"><input type="checkbox" class="checkbox" /><label>选择全部</label></p>
    						<p><a href="#">其他</a></p>
    						
    						<!-- Sort -->
    						
    						<!-- End Sort -->
    						
    					</div>
    				</div>
    				<!-- End Box -->
    			</div>
    			<!-- End Sidebar -->
    			
    			<div class="cl"> </div>			
    	
    		<!-- Main -->
    <!-- End Container -->
    
    <!-- Footer -->
    <div id="footer">
    	<div class="shell">
    		<span class="left"> </span>
    		<span class="right">
    		
    		</span>
    	</div>
    </div>
    <!-- End Footer -->
    </body>
    </html>
    

      

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
        <%@ page import="java.sql.*" %>
    <jsp:useBean id="dao" class="Dao.Dao" scope="page"/>
    <!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=UTF-8">
    <link rel="stylesheet" href="css/style1.css" type="text/css" media="all" />
    <title>失物信息管理</title>
    
    </head>
    <body>
    <%
    if(session.getAttribute("userName")==null)
    {
    	response.sendRedirect("jiemian.jsp");
    }
    %>
    <%
    	     Object message = request.getAttribute("message");//放置一个字符串,并取出
    	     if(message!=null && !"".equals(message)){
    	 
    	%>
    	     <script type="text/javascript">
    	          alert("<%=request.getAttribute("message")%>");
    	     </script>
    <%} %>
    <!-- Header -->
    <div id="header">
    	<div class="shell">
    		<!-- Logo + Top Nav -->
    		<div id="top">
    			<h1><a href="#">管理员界面</a></h1>
    			<div id="top-navigation">
    				欢迎 <a href="#"><strong>管理员</strong></a>
    				<span>|</span>
    				<a href="#">帮助</a>
    				<span>|</span>
    				<a href="index.jsp">退出</a>
    				<span>|</span>
    			</div>
    		</div>
    		<!-- End Logo + Top Nav -->
    		
    		<!-- Main Nav -->
    		<div id="navigation">
    			<ul>
    			    <li><a href="managerds.jsp" ><span>失物信息管理</span></a></li>
    			    <li><a href="managerjd.jsp"class="active"><span>招领信息管理</span></a></li>
    			    <li><a href="usermanager.jsp"><span>用户管理</span></a></li>
    			    
    			</ul>
    		</div>
    		<!-- End Main Nav -->
    	</div>
    </div>
    <!-- End Header -->
    
    <!-- Container -->
    <div id="container">
    	<div class="shell">
    		
    		<!-- Small Nav -->
    		
    		<!-- End Small Nav -->
    		
    		<!-- Message OK -->		
    		<!--
    		<div class="msg msg-ok">
    			<p><strong>Your file was uploaded succesifully!</strong></p>
    			<a href="#" class="close">close</a>
    		</div> --> 
    		<!-- End Message OK -->		
    		
    		<!-- Message Error -->
    		<!--
    		<div class="msg msg-error">
    			<p><strong>You must select a file to upload first!</strong></p>
    			<a href="#" class="close">close</a>
    		</div>  -->
    		
    		
    		<!-- End Message Error -->
    		<br />
    		<!-- Main -->
    		<div id="main">
    			<div class="cl"> </div>
    			
    			<!-- Content -->
    			<div id="content">
    				
    				<!-- Box -->
    				<div class="box">
    					<!-- Box Head -->
    					<form action="searchjdByuserName.jsp" method="post">
    					<div class="box-head">
    						<h2 class="left">失物信息列表</h2>
    						
    						<div class="right">
    							<input type="text" name="userName"   class="field small-field" />
    							<input type="submit" class="button" value="查询" />
    						</div>
    						
    					</div>
    					</form>
    					<!-- End Box Head -->	
    
    					<!-- Table -->
    					<form action="addServlet?method=deletejd" method="post">
    					<div class="table">
    						<table width="100%" border="0" cellspacing="0" cellpadding="0">
    							<tr>
    								<th width="13"> </th>
    								<th>发布人</th>
    								<th>物品类别</th>
    								<th>丢失地点</th>
    								<th>丢失时间</th>
    								<th>联系方式</th>
    								<th>详细信息</th>
    								<th width="110" class="ac">操作</th>
    							</tr>
    							<%
            ResultSet rs=dao.listAlljd();
    		int number = 1;
    		
    		
    		 
    		
          if(rs==null){
        	  %>
              <tr align="center" valign="middle"><td colspan="4">没有记录显示!</td>
              </tr>
              <%
           }
          else{
        	  
    		while(rs.next()){%>
    							<tr>
    								<td><input type="checkbox" class="checkbox" name="checkjd" value="<%=rs.getInt("id") %>" /></td>
    								<td><h3><%=rs.getString("userName") %></h3></td>
    								<td><h3><%=rs.getString("name") %></h3></td>
    								<td><%=rs.getString("place") %></td>
    								<td><%=rs.getString("time") %></td>
    								<td><%=rs.getString("people") %></td>
    								<td><%=rs.getString("info") %></td>
    								
    								<td><a onclick="return check()"  href="deletejd.jsp?id=<%=rs.getString("id") %>" class="ico del">删除</a><a href="updatejd.jsp?id=<%=rs.getInt("id") %>" class="ico edit">修改</a></td>
    							</tr>
    							<%
    							number++;}
    							}%>
    						
    						</table>
    						</div>
    					<script type="text/javascript">
    		function check() {
    			if (confirm("确定删除吗?")){
    				return true;
    			}else{
    				return false;
    			}
    		}
    	</script>		
    						
    						<!-- Pagging -->
    						<div class="pagging">
    							<div class="left">1-<%=number-1 %></div>
    							<div class="left">
    							 		<input type="submit"onclick="return check()" class="button" value="删除所选内容" />
    							 		</div></div>
    						    </form>
    						    </div>
    							<div class="right">
    								<a href="#">前一页</a>
    								<a href="#">1</a>
    								<a href="#">2</a>
    								<a href="#">3</a>
    								<a href="#">4</a>
    								<span>...</span>
    								<a href="#">下一页</a>
    							</div>
    						</div>
    						<!-- End Pagging -->
    						
    					</div>
    					<!-- Table -->
    					
    				</div>
    				<!-- End Box -->
    				
    				<!-- Box -->
    				<div class="box">
    					<!-- Box Head -->
    					<div class="box-head">
    						<h2>添加备注记录</h2>
    					</div>
    					<!-- End Box Head -->
    					
    					<form action="" method="post">
    						
    						<!-- Form -->
    						<div class="form">
    								<p>
    									<span class="req">100字以内</span>
    									<label>备注主题<span>(必填)</span></label>
    									<input type="text" class="field size1" />
    								</p>	
    								<p class="inline-field">
    									<label>日期</label>
    									<input type="datetime-local" class="field size1" name="date">
    								</p>
    								
    								<p>
    									<span class="req">1000以内</span>
    									<label>备注内容 <span>(必填)</span></label>
    									<textarea class="field size1" rows="10" cols="30"></textarea>
    								</p>	
    							
    						</div>
    						<!-- End Form -->
    						
    						<!-- Form Buttons -->
    						<div class="buttons">
    							<input type="submit" class="button" value="提交" />
    						</div>
    						<!-- End Form Buttons -->
    					</form>
    				</div>
    				<!-- End Box -->
    
    			</div>
    			<!-- End Content -->
    			
    			<!-- Sidebar -->
    			<div id="sidebar">
    				
    				<!-- Box -->
    				<div class="box">
    					
    					<!-- Box Head -->
    					<div class="box-head">
    						<h2>管理</h2>
    					</div>
    					<!-- End Box Head-->
    					
    					<div class="box-content">
    						
    						<div class="cl"> </div>
    						
    						<p class="select-all"><input type="checkbox" class="checkbox" /><label>选择全部</label></p>
    						<p><a href="#">其他</a></p>
    						
    						<!-- Sort -->
    						
    						<!-- End Sort -->
    						
    					</div>
    				</div>
    				<!-- End Box -->
    			</div>
    			<!-- End Sidebar -->
    			
    			<div class="cl"> </div>			
    
    		<!-- Main -->
    <!-- End Container -->
    
    <!-- Footer -->
    <div id="footer">
    	<div class="shell">
    		<span class="left"> </span>
    		<span class="right">
    		
    		</span>
    	</div>
    </div>
    <!-- End Footer -->
    </body>
    </html>
    

      

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
       <%@ page import="java.sql.*" %>
    <jsp:useBean id="dao" class="Dao.Dao" scope="page"/>
    <!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=UTF-8">
    <link rel="stylesheet" href="css/style1.css" type="text/css" media="all" />
    <title>失物信息管理</title>
    <style> 
            .black_overlay{ 
                display: none; 
                position: absolute; 
                top: 0%; 
                left: 0%; 
                 100%; 
                height: 100%; 
                background-color: black; 
                z-index:1001; 
                -moz-opacity: 0.8; 
                opacity:.80; 
                filter: alpha(opacity=88); 
            } 
            .white_content { 
                display: none; 
                position: absolute; 
                top: 25%; 
                left: 25%; 
                 55%; 
                height: 55%; 
                padding: 20px; 
                border: 10px solid orange; 
                background-color: white; 
                z-index:1002; 
                overflow: auto; 
            } 
        </style> 
    </head>
    <body>
    <%
    	     Object message = request.getAttribute("message");//放置一个字符串,并取出
    	     if(message!=null && !"".equals(message)){
    	 
    	%>
    	     <script type="text/javascript">
    	          alert("<%=request.getAttribute("message")%>");
    	     </script>
    <%} %>
    <!-- Header -->
    <div id="header">
    	<div class="shell">
    		<!-- Logo + Top Nav -->
    		<div id="top">
    			<h1><a href="#">管理员界面</a></h1>
    			<div id="top-navigation">
    				欢迎 <a href="#"><strong>管理员</strong></a>
    				<span>|</span>
    				<a href="#">帮助</a>
    				<span>|</span>
    				<a href="index.jsp">退出</a>
    				<span>|</span>
    			</div>
    		</div>
    		<!-- End Logo + Top Nav -->
    		
    		<!-- Main Nav -->
    		<div id="navigation">
    			<ul>
    			    <li><a href="managerds.jsp" class="active"><span>失物信息管理</span></a></li>
    			    <li><a href="managerjd.jsp"><span>招领信息管理</span></a></li>
    			    <li><a href="usermanager.jsp"><span>用户管理</span></a></li>
    			    
    			</ul>
    		</div>
    		<!-- End Main Nav -->
    	</div>
    </div>
    <!-- End Header -->
    
    <!-- Container -->
    <div id="container">
    	<div class="shell">
    		
    		<div id="main">
    			<div class="cl"> </div>
    			
    			<!-- Content -->
    			<div id="content">
    				
    				<!-- Box -->
    				<div class="box">
    
    <%        int id = Integer.parseInt(request.getParameter("id"));
              System.out.print("id:"+id);
    		ResultSet rs=dao.listdsByid(id);
    		if(rs==null){ 
        	  %>
        	  
        	  
                   没有记录显示!
              
              
              
              
              <%
           }
          else{
        	  
    		if(rs.next()){%>
    						
    								
    								
    								<!-- Box -->
    				<div class="box">
    					<!-- Box Head -->
    					<div class="box-head">
    						<h2>修改信息</h2>
    					</div>
    					<!-- End Box Head -->
    					
    					<form action="addServlet?method=updateds" method="post">
    						
    						<!-- Form -->
    						<div class="form">
    								<p>
    									
    									<label>发布人</label>
    									<input type="text" name="userName" value="<%=rs.getString("userName") %>" class="field size1" />
    								</p> 
    								<P><label>物品类别</label><input type="text" name="name" value=" <%=rs.getString("name") %>" class="field size1"></P> 
    								<P><label>丢失地点</label><input type="text" name="place" value=" <%=rs.getString("place") %>" class="field size1" ></P>
    								<P><label>丢失时间</label><input type="datetime-local" name="time"  class="field size1"></P> 
    								<P><label>联系方式</label><input type="text" name="people" value=" <%=rs.getString("people") %>" class="field size1"></P> 
    								<P><label>详细信息</label><input type="text" name="info" value=" <%=rs.getString("info") %>" class="field size1" ></P> 
    								<input type="hidden" name="id" value="<%=rs.getInt("id") %>">
    							
    						</div>
    						<!-- End Form -->
    						
    						<!-- Form Buttons -->
    						<div class="buttons">
    							<input type="submit" class="button" value="确认修改" />
    						</div>
    						<!-- End Form Buttons -->
    					</form>
    				</div>
    				<!-- End Box -->
    
    			</div>
    		<%
    							}
    							}
    							%>		
    						
    					
    					<!-- Table -->
    					
    				</div>
    				<!-- End Box -->
    				
    				<!-- Box -->
    
    				<!-- End Box -->
    
    			</div>
    			<!-- End Content -->
    			
    			<!-- Sidebar -->
    			
    			<!-- End Sidebar -->
    			
    			<div class="cl"> </div>			
    		</div>
    		<!-- Main -->
    	</div>
    
    <!-- End Container -->
    
    <!-- Footer -->
    <div id="footer">
    	<div class="shell">
    		<span class="left"> </span>
    		<span class="right">
    		
    		</span>
    	</div>
    </div>
    <!-- End Footer -->
    </body>
    </html>
    

      

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
       <%@ page import="java.sql.*" %>
    <jsp:useBean id="dao" class="Dao.Dao" scope="page"/>
    <!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=UTF-8">
    <link rel="stylesheet" href="css/style1.css" type="text/css" media="all" />
    <title>失物信息管理</title>
    <style> 
            .black_overlay{ 
                display: none; 
                position: absolute; 
                top: 0%; 
                left: 0%; 
                 100%; 
                height: 100%; 
                background-color: black; 
                z-index:1001; 
                -moz-opacity: 0.8; 
                opacity:.80; 
                filter: alpha(opacity=88); 
            } 
            .white_content { 
                display: none; 
                position: absolute; 
                top: 25%; 
                left: 25%; 
                 55%; 
                height: 55%; 
                padding: 20px; 
                border: 10px solid orange; 
                background-color: white; 
                z-index:1002; 
                overflow: auto; 
            } 
        </style> 
    </head>
    <body>
    <%
    	     Object message = request.getAttribute("message");//放置一个字符串,并取出
    	     if(message!=null && !"".equals(message)){
    	 
    	%>
    	     <script type="text/javascript">
    	          alert("<%=request.getAttribute("message")%>");
    	     </script>
    <%} %>
    <!-- Header -->
    <div id="header">
    	<div class="shell">
    		<!-- Logo + Top Nav -->
    		<div id="top">
    			<h1><a href="#">管理员界面</a></h1>
    			<div id="top-navigation">
    				欢迎 <a href="#"><strong>管理员</strong></a>
    				<span>|</span>
    				<a href="#">帮助</a>
    				<span>|</span>
    				<a href="index.jsp">退出</a>
    				<span>|</span>
    			</div>
    		</div>
    		<!-- End Logo + Top Nav -->
    		
    		<!-- Main Nav -->
    		<div id="navigation">
    			<ul>
    			    <li><a href="managerds.jsp" class="active"><span>失物信息管理</span></a></li>
    			    <li><a href="managerjd.jsp"><span>招领信息管理</span></a></li>
    			    <li><a href="usermanager.jsp"><span>用户管理</span></a></li>
    			    
    			</ul>
    		</div>
    		<!-- End Main Nav -->
    	</div>
    </div>
    <!-- End Header -->
    
    <!-- Container -->
    <div id="container">
    	<div class="shell">
    		
    		<div id="main">
    			<div class="cl"> </div>
    			
    			<!-- Content -->
    			<div id="content">
    				
    				<!-- Box -->
    				<div class="box">
    
    <%        int id = Integer.parseInt(request.getParameter("id"));
    		ResultSet rs=dao.listjdByid(id);
    		if(rs==null){ 
        	  %>
        	  
        	  
                   没有记录显示!
              
              
              
              
              <%
           }
          else{
        	  
    		if(rs.next()){%>
    						
    								
    								
    								<!-- Box -->
    				<div class="box">
    					<!-- Box Head -->
    					<div class="box-head">
    						<h2>修改信息</h2>
    					</div>
    					<!-- End Box Head -->
    					
    					<form action="addServlet?method=updatejd" method="post">
    						
    						<!-- Form -->
    						<div class="form">
    								<p>
    									
    									<label>发布人</label>
    									<input type="text" name="userName" value="<%=rs.getString("userName") %>" class="field size1" />
    								</p> 
    								<P><label>物品类别</label><input type="text" name="name" value=" <%=rs.getString("name") %>" class="field size1"></P> 
    								<P><label>丢失地点</label><input type="text" name="place" value=" <%=rs.getString("place") %>" class="field size1" ></P>
    								<P><label>丢失时间</label><input type="datetime-local" name="time"  class="field size1"></P> 
    								<P><label>联系方式</label><input type="text" name="people" value=" <%=rs.getString("people") %>" class="field size1"></P> 
    								<P><label>详细信息</label><input type="text" name="info" value=" <%=rs.getString("info") %>" class="field size1" ></P> 
    								<input type="hidden" name="id" value="<%=rs.getInt("id") %>">
    							
    						</div>
    						<!-- End Form -->
    						
    						<!-- Form Buttons -->
    						<div class="buttons">
    							<input type="submit" class="button" value="确认修改" />
    						</div>
    						<!-- End Form Buttons -->
    					</form>
    				</div>
    				<!-- End Box -->
    
    			</div>
    		<%
    							}
    							}
    							%>		
    						
    					
    					<!-- Table -->
    					
    				</div>
    				<!-- End Box -->
    				
    				<!-- Box -->
    
    				<!-- End Box -->
    
    			</div>
    			<!-- End Content -->
    			
    			<!-- Sidebar -->
    			
    			<!-- End Sidebar -->
    			
    			<div class="cl"> </div>			
    		</div>
    		<!-- Main -->
    	</div>
    
    <!-- End Container -->
    
    <!-- Footer -->
    <div id="footer">
    	<div class="shell">
    		<span class="left"> </span>
    		<span class="right">
    		
    		</span>
    	</div>
    </div>
    <!-- End Footer -->
    </body>
    </html>
    

      

    public ResultSet searchdsByuserName(String userName) {
    		String sql = "select * from ds where userName ='"  +userName+"'";
    	   		Connection conn = db.getConn();
    	   		ResultSet rs = null;
    	   		try{
    				 Statement state = conn.createStatement();
    				 rs=state.executeQuery(sql);
    			}catch(SQLException e){
    				e.printStackTrace();
    			}
    			return rs;
        }
    	public ResultSet searchjdByuserName(String userName) {
    		String sql = "select * from jd where userName ='"  +userName+"'";
    	   		Connection conn = db.getConn();
    	   		ResultSet rs = null;
    	   		try{
    				 Statement state = conn.createStatement();
    				 rs=state.executeQuery(sql);
    			}catch(SQLException e){
    				e.printStackTrace();
    			}
    			return rs;
        }
    	
    	public ResultSet listdsByid(int id) {
    		String sql = "select * from ds where id =" + id;
    	   		Connection conn = db.getConn();
    	   		ResultSet rs = null;
    	   		try{
    				 Statement state = conn.createStatement();
    				 rs=state.executeQuery(sql);
    			}catch(SQLException e){
    				e.printStackTrace();
    			}
    			return rs;
        }
    	public ResultSet listjdByid(int id) {
    		String sql = "select * from jd where id ='"  +id+"'";
    	   		Connection conn = db.getConn();
    	   		ResultSet rs = null;
    	   		try{
    				 Statement state = conn.createStatement();
    				 rs=state.executeQuery(sql);
    			}catch(SQLException e){
    				e.printStackTrace();
    			}
    			return rs;
        }
    	public boolean deleteds (int id) {
    		boolean f = false;
    		String sql = "delete from ds where id='" + id + "'";
    		
    		Connection conn = db.getConn();
    		Statement state = null;
    		int a = 0;
    		
    		try {
    			state = conn.createStatement();
    			a = state.executeUpdate(sql);
    		} catch (SQLException e) {
    			e.printStackTrace();
    		} finally {
    			db.close(state, conn);
    		}
    		
    		if (a > 0) {
    			f = true;
    		}
    		return f;
    	}
    	public boolean deletejd (int id) {
    		boolean f = false;
    		String sql = "delete from jd where id='" + id + "'";
    		
    		Connection conn = db.getConn();
    		Statement state = null;
    		int a = 0;
    		
    		try {
    			state = conn.createStatement();
    			a = state.executeUpdate(sql);
    		} catch (SQLException e) {
    			e.printStackTrace();
    		} finally {
    			db.close(state, conn);
    		}
    		
    		if (a > 0) {
    			f = true;
    		}
    		return f;
    	}
    public boolean deleteds(int [] id) {
    		// TODO Auto-generated method stub
    		int number = id.length;
    		boolean f = false;
    		int i = 0;
    		int sum = 0;
    		while(i < number) {
    			String sql = "delete from ds where id='" + id[i] + "'";
    			i++;
    			Connection conn = db.getConn();
    			Statement state = null;
    			int a = 0;
    			
    			try {
    				state = conn.createStatement();
    				a = state.executeUpdate(sql);
    			} catch (SQLException e) {
    				e.printStackTrace();
    			} finally {
    				db.close(state, conn);
    			}
    			if(a == 1 ) {
    				sum = sum + 1;
    			}
    		}
    		
    		
    		
    		if (sum == id.length) {
    			f = true;
    		}
    		return f;
    	}
    	public boolean deletejd(int [] id) {
    		// TODO Auto-generated method stub
    		int number = id.length;
    		boolean f = false;
    		int i = 0;
    		int sum = 0;
    		while(i < number) {
    			String sql = "delete from jd where id='" + id[i] + "'";
    			i++;
    			Connection conn = db.getConn();
    			Statement state = null;
    			int a = 0;
    			
    			try {
    				state = conn.createStatement();
    				a = state.executeUpdate(sql);
    			} catch (SQLException e) {
    				e.printStackTrace();
    			} finally {
    				db.close(state, conn);
    			}
    			if(a == 1 ) {
    				sum = sum + 1;
    			}
    		}
    		
    		
    		
    		if (sum == id.length) {
    			f = true;
    		}
    		return f;
    	}
    	
    	public boolean updateds( int id,String name,String place,String time,String people,String info) {
    		String sql = "update ds set name='" + name + "', place='" + place
    		+ "', time='" + time + "', people='" + people +"', info='" + info + "' where id='"
    		+ id + "'";
    		Connection conn = db.getConn();
    		Statement state = null;
    		boolean f = false;
    		int a = 0 ;
    		
    		try {
    			state = conn.createStatement();
    			a = state.executeUpdate(sql);
    		} catch (Exception e) {
    			e.printStackTrace();
    		} finally {
    			db.close(state, conn);
    		}
    		
    		if (a > 0) {
    			f = true;
    		}
    		return f;
    		
    	}
    	public boolean updatejd(int id,String name,String place,String time,String people,String info) {
    		String sql = "update jd set name='" + name + "', place='" + place
    				+ "', time='" + time + "', people='" + people +"', info='" + info + "' where id='"
    				+ id + "'";
    		Connection conn = db.getConn();
    		Statement state = null;
    		boolean f = false;
    		int a = 0 ;
    		
    		try {
    			state = conn.createStatement();
    			a = state.executeUpdate(sql);
    		} catch (Exception e) {
    			e.printStackTrace();
    		} finally {
    			db.close(state, conn);
    		}
    		
    		if (a > 0) {
    			f = true;
    		}
    		return f;
    		
    	}
    	public boolean addTip(String name,String email,String message) {
    		String sql = "insert into tip(name,email,message) values('" + name + "','" + email + "','" + message + " ')";
    		Connection conn = db.getConn();
    		Statement state = null;
    		boolean f = false;
    		int a = 0 ;
    		
    		try {
    			state = conn.createStatement();
    			a = state.executeUpdate(sql);
    		} catch (Exception e) {
    			e.printStackTrace();
    		} finally {
    			//鍏抽棴z	杩炴帴
    			db.close(state, conn);
    		}
    		
    		if (a > 0) {
    			f = true;
    		}
    		return f;
    	}
    	
    

      

  • 相关阅读:
    学习php 韩顺平 数据类型 三元运算,字符串运算类型运算
    学习php 韩顺平
    贪小便宜吃大亏关于汇泽平板和智能手表
    学习spring的第三天
    学习spring的第二天
    学习spring的第一天
    mybatis批量添加和删除
    关于mybatis的<selectKey>中的keyColumn
    mybatis+maven+父子多模块进行crud以及动态条件查询
    mybatis的插入数据后的主键获取
  • 原文地址:https://www.cnblogs.com/zjl-0217/p/10933487.html
Copyright © 2020-2023  润新知