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

📄 systemmaintain.jsp

📁 system1为用户注册模块 system2为在线聊天系统 system3为在线投票系统 system4为在线考试系统 system5为新闻发布模块
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" 
		language="java"
		import = "com.newwindows.hzdtv.sql.*,java.util.*, java.text.*"
		%>
<jsp:useBean id="bean0" scope="session" class="com.newwindows.hzdtv.session.SessionBean" />
<%! ReturnData data1=null,data2=null,rd=null;
    boolean afterdel=false; %>
<%
String menu="";
	try
	{
		menu =  request.getParameter("menu");
	}
	catch(Exception ex)
	{
		menu="update";
	}
	if (menu==null || menu =="")
	{
		menu="update";
	}
	bean0.trace("-------menu-------------" +menu);

if(menu.equals("del"))
{
	String tmp;
	
	tmp="delete from dtv_comm where CommID="+request.getParameter("CommID");
	bean0.execute(tmp);
	tmp = "delete from Dtv_CommMenu where CommID="+request.getParameter("CommID");
   if(bean0.execute(tmp))
   {
	out.println("<script>alert('信息删除成功!');location.href='systemmaintain.jsp'</script>");
	afterdel = true;
   }
  else
		out.println("<script>alert('信息删除失败!');location.href='systemmaintain.jsp'</script>");
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="Style.css" type=text/css rel=stylesheet>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
}
-->
</style>
<script language="javascript">
function del(url,id)
{
 if (confirm('\n真的要删除此条记录吗?'))
   location=url+"?menu=del&CommID="+id
}
function update(id,name)
{
   form1.textcommid.value = id;
   form1.textcommname.value = name
}
</script>
</head>

<body>
<!--<a href="info.jsp">添加信息</a> -->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td  valign="top" >
    <table width="99%" cellpadding=0 cellspacing=0 align=center>
    	<form  name="form1" method="post" action="systemmaintain.jsp">
    	<tr><td align=left>
    	社区编号:
    	    <input id="textcommid" name="CommID" type="text" value="" size="8" height="18" action="systemmaintain.jsp">
		  </input>
		  社区名称:
		  <input id="textcommname" name="CommName" type="text" size="22" height="18" action="systemmaintain.jsp">
			  
            </input>
			
       
       社区网址:
       <input type="text" size=22 name=key height=18 id="texturl" action="systemmaintain.jsp">
       <input type="button"  value="添加"  onclick="sub()">
    	</td></tr>
    	</form>
	
    </table>
	<table width="99%" border="1" align="center" cellpadding="2" bordercolor="#C0C0C0" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" bgcolor="#EEEEEE">
      <tr height=22>
	    <td width="25%" align=center>社区编号</tD>
		<td width="28%" align=center>社区名称</tD>
        <td width="35%" align=center>社区网址</tD>
		<td width="12%" align=center>操作</tD>
	  </tr>
	  <%
	    if(afterdel == false )
	    {
	      String exeStrSQL = "";
	      String localCommID= "";
	      String localCommName = "";
	      localCommID = request.getParameter("CommID");
	      localCommName = request.getParameter("CommName"); 
	      if(localCommID!=null && localCommID!="")
	      {
	        ReturnData rd1=bean0.query("select * from Dtv_Comm where CommID="+localCommID);
	        
	        bean0.query("delete from Dtv_Comm where CommID="+localCommID);
	        exeStrSQL ="insert into Dtv_Comm values ("+localCommID+","+"'"+localCommName+"','')";
	        exeStrSQL = bean0.parseChinese(exeStrSQL);
	        bean0.execute(exeStrSQL);
	        if(rd1.getSize()==0)
	        {
	            exeStrSQL = "insert into Dtv_CommMenu (menuid,commid) select menuid,b.commid from Dtv_Menu a ,Dtv_Comm b "
	                        +"where b.commid="+localCommID;
	            exeStrSQL = bean0.parseChinese(exeStrSQL);
	            bean0.execute(exeStrSQL); 
	        }           
	       }
	    }
	  	String strSQL="";
	  	int CommID=0;
	  	if(request.getParameter("CommID")!=null && request.getParameter("CommID")!="")	  	
	  		CommID=Integer.parseInt(request.getParameter("CommID"));	 	 	  		
	  	//if(CommID!=0)
	  	//	strSQL+=" dtv_Comm.CommID=" + CommID;
	  	//else
	  	    strSQL = "select *  from dtv_Comm "  + " order by CommID ";
		  	ReturnData rd=bean0.query(strSQL);
        if(rd!=null && rd.getSize()>0)
		  {
		  for(int i=0;i<rd.getSize();i++)
			  {
				out.println("<tr height=22>");
				out.println("<td>·"+rd.fieldByName("CommID")+"</td>");
				out.println("<td align=center>"+rd.fieldByName("CommName")+"</td>");
				out.println("<td align=center>"+rd.fieldByName("Url")+"</td>");
				%>
				<script laguage="javascript" >
				</script>
				<td align=center><a href="javascript:update('<%=rd.fieldByName("CommID")%>','<%=rd.fieldByName("CommName")%>')">修改</a>&nbsp;&nbsp;<a href="javascript:del('systemmaintain.jsp',<%=rd.fieldByName("CommID")%>)">删除</a></td></tr>
				<%
				rd.next();
			  }
		  }
		 afterdel = false;
		  %>
	  </table></td>
  </tr>
</table>
<script language="javascript">
	     function sub(){
		     if(document.form1.CommID.value==""){
			     window.alert("请输入社区号!");
				 window.form1.CommID.focus();
				 return false;
			 }
			 if(document.form1.CommName.value==""){
			     window.alert("请输入社区名称!");
				 window.form1.CommName.focus();
				 return false;
			 } 
			
				 document.form1.submit();
		}
			
	</script>
</body>
</html>

⌨️ 快捷键说明

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