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

📄 list.jsp

📁 基于jsp-servlet-bean结构开发的,具备新闻发布管理、3级栏目管理、用户管理等功能。注意
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GB2312" pageEncoding="GB2312"%>
<%@page import="com.ideas.util.*,java.util.*"%>
<%	
//超时提示
if((String)session.getAttribute("login")==null) {
	response.sendRedirect("../session.htm");
}
%>
<jsp:useBean id="myBean" scope="page" class="com.ideas.bean.menu2Bean"/>
<%
	int intPageSize; //一页显示的记录数
	int intRowCount; //记录总数
	int intPageCount; //总页数
	int intPage; //待显示页码
	String strPage;

	

	//设置一页显示的记录数
	intPageSize =  Configuration.Number_shown;

	//取得待显示页码
	strPage = request.getParameter("page");
	if(strPage==null){//表明在QueryString中没有page这一个参数,此时显示第一页数据
	intPage = 1;
	}
	else{//将字符串转换成整型
	intPage = java.lang.Integer.parseInt(strPage);
	if(intPage<1) intPage = 1;
	}

	int recno=(intPage-1)*intPageSize+1;


	//DBConnectionManager connMgr=DBConnectionManager.getInstance();
	//Connection con = connMgr.getConnection(Configuration.ConnectionPoolName);

	//创建数据库连接
	if (!myBean.getMyConnPool()) {
      out.println("不能获取数据库连接.");
      return;
    }

	//edit
	String id1 = (String)request.getParameter("id");
	String type1 = (String)request.getParameter("type");
	String name1 = (String)request.getParameter("name");
	String id1_1 = (String)request.getParameter("id1");
	String href1 = (String)request.getParameter("href");
	String isuse1 = (String)request.getParameter("isuse");
	if(name1==null)name1 = "";
	name1 = new String(name1.getBytes("ISO-8859-1"),"GBK");
	if(type1==null)type1 = "";
	int error = 0;

	if(type1.equals("1"))
	{
		Hashtable hash= new Hashtable();
        hash.put("name", name1);
		hash.put("id1", id1_1);
        hash.put("href", href1);
        hash.put("isuse", isuse1);
		error = myBean.add(hash);
	}
	else if(type1.equals("2"))
	{
		myBean.setID(id1);
		Hashtable hash= new Hashtable();
        hash.put("name", name1);
		hash.put("id1", id1_1);
        hash.put("href", href1);
        hash.put("isuse", isuse1);
		error = myBean.mod(hash);
	}
	else if(type1.equals("3"))
	{
		myBean.setID(id1);
		myBean.del();
	}










	//取得当前页的数据
	Vector vect = myBean.getCurPage(intPage,intPageSize);

	//获取记录总数
	intRowCount = Integer.parseInt((String)vect.get(0));
	//记算总页数
	intPageCount = Integer.parseInt((String)vect.get(1));
	//调整待显示的页码
	if(intPage>intPageCount) intPage = intPageCount;
      
%>
<html>
<head>
<title>二级菜单维护</title>
<link rel="STYLESHEET" type="text/css" href="../css/yj.css">
</head>
<body>
<center><H1>二级菜单维护</H1></center>
<h2>&nbsp;&nbsp;第<%=intPage%>页 共<%=intPageCount%>页(<%=intRowCount%>条) <a href="list.jsp?">首页</a>  <%if(intPage>1){%><a href="list.jsp?&page=<%=intPage-1%>">上一页</a><%}%> <%if(intPage<intPageCount){%><a href="list.jsp?&page=<%=intPage+1%>">下一页</a><%}%> <a href="list.jsp?&page=<%=intPageCount%>">尾页</a>&nbsp;&nbsp;<a onclick="javascript:window.location.reload();" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';" style="cursor:hand;" ><font color="blue">刷新数据</font></a></h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
 	<th width="8%"  align="center" >序号</th>  	
 	<th width="20%" align="center" >二级菜单名称</th>
	<th width="20%" align="center" >所在一级菜单</th>
	<th width="20%" align="center" >子页标头图片</th>
	<th width="*" align="center" >审核</th>
	<th width="19%"  align="center"><A onclick="add('');" style="cursor:hand;" class="hold1">〖新增〗</A></th>
 <tr>
  <%
	if(intPageCount>0){

	for (int line=2;line<vect.size();line++) {
		Hashtable hash = (Hashtable)vect.get(line);
		String mode=null;
		if  (line%2==1)
			mode="row3";
		else
			mode="row1";    
		String id = (String)hash.get("id");
		String isuse = (String)hash.get("isuse");
		String t = "通过";
		if(isuse.equals("0"))t = "挂起";
      		%>
  <tr>
  			 <td height=21 align="center" class="<%=mode%>" ><%=recno++%></td> 
 			 <td align="center" class="<%=mode%>" ><%=hash.get("name")%></td>
			 <td align="center" class="<%=mode%>" ><%=hash.get("menu1name")%></td>
			 <td align="left" class="<%=mode%>" ><%=hash.get("href")%></td>
    		 <td align="center" class="<%=mode%>" ><%=t%></td>
			 <td align="center" class="<%=mode%>">	 
			 <A onclick="edit('<%=id%>');"style="cursor:hand;" class="hold">『修改』</A>
			 <A onclick="del('<%=id%>');" style="cursor:hand;" class="hold">『删除』</A>
			</td>
  </tr> 
  <%
  }
  }//end for%> 

</table>
<form name=form1 action="" method=post>
</form>
<%
        

        //connMgr.freeConnection(Configuration.ConnectionPoolName, con);
        myBean.releaseMyConnPool();
		%>
  <script>
	function add()
	{
		document.all.form1.action = "edit.jsp?type=1&page=<%=intPageCount%>";
		document.all.form1.submit();
	}

	function edit(id)
	{
		document.all.form1.action = "edit.jsp?type=2&id="+id+"&page=<%=intPageCount%>";
		document.all.form1.submit();
	}

	function del(id)
	{
		if(!confirm("是否真的要删除?"))
		{
		}
		else
		{
			document.all.form1.action = "list.jsp?type=3&id="+id+"&page=<%=intPageCount%>";
			document.all.form1.submit();
		}
	}

</script>
</body>
</html>
     

⌨️ 快捷键说明

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