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

📄 updatepurview.jsp

📁 SSH的平台搭建
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'updatePurview.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	<link href="admin/style/css.css" rel="stylesheet" type="text/css">
	-->
<link href="admin/style/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
      function addPurviewToUser()
      {
		   var selectedOption = null;
		   var optionsLeft = document.getElementById("left").options;
           for(var i=0;i<optionsLeft.length;i++)
           {
			  if(optionsLeft[i].selected==true)
			  {
				 selectedOption = optionsLeft[i];
			  }
			}
			var optionsRight = document.getElementById("right").options;
			var flag = 0;
			for(i=0;i<optionsRight.length;i++)
			{
			  if(optionsRight[i].value==selectedOption.value)
			  {
			     alert("已有"+optionsRight[i].value+"这个权限了");
				 flag=1;
			  }
			}
			if(flag==0)
			{
			   var tempOption = new Option(selectedOption.text,selectedOption.value);
			   optionsRight[optionsRight.length]=tempOption;
			}
       }
		 
	     function removePurviewFromUser()
		 {
		   var optionsRight = document.getElementById("right").options;
			for(var i=0;i<optionsRight.length;i++)
			{
			  if(optionsRight[i].selected==true)
			  {
			    optionsRight.removeChild(optionsRight[i]);
			  }
			} 
		 }
		 function removeAllPurviewFromUser()
		 {
		    document.getElementById("right").options.innerHTML="";
		 }
		 function check()
		 {
		    var optionsRight = document.getElementById("right").options;
		    var allItems = "";
		    for(var i=0;i<optionsRight.length;i++)
		    {
		      if(i==optionsRight.length-1)
		      {
		        allItems+=optionsRight[i].value;
		        break;
		      }
		      allItems+=optionsRight[i].value+"_";
		    }
		   
		    var f = document.form;
		    f.action = "admin.do?method=configurePurview&userPurviews="+allItems;
		   
		    f.submit(); 
		 }
     </script>
	</head>

	<body background="images/body.gif" >
	<form name="form" action="admin.do" method="post">
		<table width="600" cellspacing="0" cellpadding="0" align="left">
			<tr>
				<td height="61">
					<img src="admin/images/bannerywgl.gif">
				</td>
			</tr>
			<tr height="500">
				<td background="admin/images/mainbg1.gif" valign="top">
					<img src="admin/images/title-gh.gif" width="250" height="80">
					<table width="96%" align="center" cellpadding="1" cellspacing="1"
						bgcolor="E7FFFE" class="main">
						<tr class="title">
							<td>
								编号:<input type="text" value="${adminPurview.id }" style="border:0px;" name="adminId"/>
							</td>
							<td>
								名称:${adminPurview.name }
							</td>
						</tR>
						<tr class="title">
						  <td>所有权限:</td>
						  <td>${adminPurview.name }现有权限:</td>
						</tr>
						<tr class="title">
						<td>
						   <select id="left" multiple>
						     <c:forEach items="${purviewList}" var="purview">
						       <option value="${purview.id}">${purview.name}</option>
						     </c:forEach>
						   </select>
						</td>
						<td>
						   <select id="right" multiple>
						     <c:forEach items="${adminPurview.purviews}" var="adminPurview">
						       <option value="${adminPurview.id}">${adminPurview.name}</option>
						     </c:forEach>
						   </select>
						</td> 
						  
						</tr>
						<tr>
				  <td><input type="button" value="添加" onclick="addPurviewToUser()"/></td>
				  <td>
				    <input type="button" value="删除" onclick="removePurviewFromUser()"/>
				    <input type="button" value="清空" onclick="removeAllPurviewFromUser()"/>
				  </td>
				</tr>
				<tr>
				  <td colspan="2" align="center"><input type="button" onclick="check()"  value="提交更改"/></td>
				</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td></td>
			</tr>
		</table>
		</form>
	</body>
</html>

⌨️ 快捷键说明

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