admin_affiche.jsp

来自「JSP+ORACLE网站开发实例(下).rar」· JSP 代码 · 共 62 行

JSP
62
字号
<%@ include file="admintop.jsp"%>
<%@ include file="isadmin.jsp"%>
<%String  sql;
      String id=request.getParameter("id");   
      String title=request.getParameter("title");   
	  String action1=request.getParameter("action");  
	  String body=request.getParameter("body");

	  if(action1==null){
		  sql="select * from scott.affiche ";
      ResultSet rst=stmt.executeQuery(sql); 
    if(!rst.next()){
out.print("<script>alert('对不起,你所要操作的对象不存在\n请返回重试');history.back();</script>");
	}else{
%>


<form name="form1" method="post" action="admin_affiche.jsp?action=edit&id=<%=rst.getString("id")%>">
  <table width="350" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
    <tr bgcolor="#B1E1F3"> 
      <td height="30" colspan="2"> <div align="center"><strong>当前公告</strong></div></td>
    </tr>
    <tr> 
      <td width="69">标题:</td>
      <td width="271"> <input name="title" type="text" id="title" value="<%=rst.getString("title")%>"> </td>
    </tr>
    <tr> 
      <td>公告:</td>
      <td><textarea name="body" cols="35" rows="8" id="body"><%=rst.getString("body")%></textarea></td>
    </tr>
    <tr> 
      <td colspan="2"><div align="center">
          <input type="submit" name="Submit" value="修 改">
        </div></td>
    </tr>
  </table>
</form>
<%}
 }else{
	  if(action1.equals("edit")){		  
    stmt.executeUpdate("update scott.affiche set title='"+title+"', body='"+body+"' where id='"+id+"'");
	 
	  %>


		<table width="350" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr>
    <td height="25" bgcolor="#B4E7F1"> 
      <div align="center"><strong>修改成功</strong></div></td>
  </tr>
  <tr>
    <td>你可以返回上一页面进行查看</td>
  </tr>
  <tr>
    <td><div align="center"><a href="admin_affiche.jsp">【返回】</a></div></td>
  </tr>
</table>
<% }
} %>
</body>
</html>

⌨️ 快捷键说明

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