delnewsstep1.jsp

来自「新闻发布系统源代码 可以作为网站的模板」· JSP 代码 · 共 58 行

JSP
58
字号
<%@page contentType="text/html;charset=gb2312"%>
<%@ include file="../incoming/Common.jsp"%>
<%@ include file="../incoming/ConnectDB.jsp"%>
<%@ include file="../incoming/Check.jsp"%>
<html>
<head>
<%
		String msg="";
		String categoryid = "";
try
{
		categoryid= new String(request.getParameter("categoryid").getBytes("ISO8859_1"),"GBK");
		String newsid = new String(request.getParameter("newsid").getBytes("ISO8859_1"),"GBK");
		sql1 = "DELETE news WHERE NewsID=?";
		PreparedStatement prepstmt = null;
		prepstmt=con.prepareStatement(sql1);
		prepstmt.setInt(1,Integer.parseInt(newsid));
		prepstmt.executeUpdate();		
}
catch(Exception e)
{
	msg = e.getMessage();
}
%>
<title><%=title%>管理</title>
<link href="../incoming/style.css" rel="stylesheet" type="text/css">
<script Language="JavaScript">
function ToNewsMain()
{
  top.location="NewsMain.jsp?categoryid="+<%=categoryid%>;
}
</script> 
</head>
<body>
<table border="1" width=700 align=center cellpadding=0 cellspacing=0>
    <tr align="center" bgcolor="#CCCCCC"  height=25> 
      <td height="49"><a class="title">删除新闻</a></TD>
    </tr>
    <tr> 
      <td height="56" align="center" ><div align="right"></div><span class="text">
	  <%
	  		if(msg.equals(""))
				out.println("删除新闻成功!");
			else
				out.println("删除新闻失败!错误原因:"+msg);	
	  %>
	  </span></td>
    </tr>
    <tr> 
      <td height="36" align=center ><FONT color=#000000>
        <input name=Submit type=button value="返回新闻管理" onClick="ToNewsMain()">
      </font></td>
    </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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