【JSP开源代码栏目提醒】:网学会员在JSP开源代码频道为大家收集整理了admin_affiche.jsp提供大家参考,希望对大家有所帮助!
<%@ 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>
上一篇:
adminzone.jsp
下一篇:
空腹时饮酒更容易酒精中毒