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

📄 listclass.jsp

📁 自己写的新闻发布系统
💻 JSP
字号:
<%@page contentType="text/html; charset=ISO8859_1" language="java" %>
<%
String news_location="listclass";
%>
<%@ include file="session.jsp" %>
<%@page import="Eclass.News"%>
<%@ include file="config.jsp" %>
<%
java.sql.ResultSet rs=null;
java.sql.ResultSet rs1=null;
int bclassid=0,classid=0;
String action=request.getParameter("action");
if(action==null)
{action="";}
//----删除大类别
if(action.equals("DelBclass"))
{bclassid=Integer.parseInt(request.getParameter("bclassid"));
News empire1=new News();
empire1.DelBclass(news_basic_path,bclassid);
%>
<script>
alert("删除大类别成功");self.location.href="ListClass.jsp";
</script>
<%
return;
}
//----删除子类别
if(action.equals("DelClass"))
{classid=Integer.parseInt(request.getParameter("classid"));
News empire1=new News();
empire1.DelClass(news_basic_path,classid);
%>
<script>
alert("删除子类别成功");self.location.href="ListClass.jsp";
</script>
<%
return;
}
//----修改大类别
if(action.equals("EditBclass"))
{
bclassid=Integer.parseInt(request.getParameter("bclassid"));
String bclassname=new String(request.getParameter("bclassname").getBytes("ISO8859-1"),"gb2312");
if(bclassname.equals(""))
{
%>
<script>
alert("类别名不能为空");history.go(-1);
</script>
<%
return;
}
News empire1=new News();
empire1.EditBclass(news_basic_path,bclassid,bclassname);
%>
<script>
alert("修改大类别成功");self.location.href='ListClass.jsp';
</script>
<%
return;
}
//----修改子类别
if(action.equals("EditClass"))
{
classid=Integer.parseInt(request.getParameter("classid"));
String classname=new String(request.getParameter("classname").getBytes("ISO8859-1"),"gb2312");
if(classname.equals(""))
{
%>
<script>
alert("类别名不能为空");history.go(-1);
</script>
<%
return;
}
News empire1=new News();
empire1.EditClass(news_basic_path,classid,classname);
%>
<script>
alert("修改子类别成功");self.location.href='ListClass.jsp';
</script>
<%
return;
}
%>
<jsp:useBean id=empire scope="page" class="Eclass.jdbc_sql" />
<%
rs=empire.query("select bclassid,bclassname from enews_bclass");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../images/ebb.css" type="text/css">
<title>无标题文档</title>
<script>
function DelBclass_check(bclassid)
{var ok;
ok=confirm("您是否真的要删除?这样将删除他所属的所有新闻和类别");
if(ok)
{self.location.href="ListClass.jsp?action=DelBclass&bclassid="+bclassid;}
}
function DelClass_check(classid)
{var ok;
ok=confirm("您是否真的要删除?这样将删除他所属的所有新闻");
if(ok)
{self.location.href="ListClass.jsp?action=DelClass&classid="+classid;}
}
</script>
</head>

<body>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="3370A6">
  <tr height=25> 
    <td><div align="center"><font color="#FFFFFF">ID</font></div></td>
    <td><div align="center"><font color="#FFFFFF">新闻类别名</font></div></td>
    <td><div align="center"><font color="#FFFFFF">操作</font></div></td>
  </tr>
  <%
  while(rs.next())
  {rs1=empire.query("select classname,classid from enews_class where bclassid="+rs.getInt("bclassid"));
  %>
  <tr bgcolor="#66CCFF" height=25> 
    <form name=form1 method=post action=ListClass.jsp>
  <input type=hidden name=action value=EditBclass>
  <input type=hidden name=bclassid value=<%=rs.getInt("bclassid")%>>
      <td> 
        <div align="center"><%=rs.getInt("bclassid")%></div></td>
      <td> 
        <div align="center"><input type=text name=bclassname value="<%=rs.getString("bclassname")%>"></div></td>
      <td> 
        <div align="center"><input type=submit name=submit value=修改类别名>&nbsp;<input type=button name=button value=删除类别 onclick="DelBclass_check(<%=rs.getInt("bclassid")%>)"></div></td>
  </form>
  </tr>
  <%
  while(rs1.next())
  {
  %>
  <tr bgcolor="#FFFFFF"> 
  <form name=form1 method=post action=ListClass.jsp>
  <input type=hidden name=action value=EditClass>  
   <input type=hidden name=classid value=<%=rs1.getInt("classid")%>>
	<td><div align="center"><%=rs1.getInt("classid")%></div></td>
    <td><div align="center"><input type=text name=classname value="<%=rs1.getString("classname")%>"></div></td>
    <td><div align="center"><input type=submit name=submit value=修改类别名>&nbsp;<input type=button name=button value=删除类别 onclick="DelClass_check(<%=rs1.getInt("classid")%>)"></div></td>
  </form>
  </tr>
  <%
  }
  }
  %>
</table>
</body>
</html>
<%
rs.close();
empire.closestmt();
empire.closeconn();
%>

⌨️ 快捷键说明

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