青春、染指流年 2021-04-21 09:43 采纳率: 57.1%
浏览 116
已结题

求助,管理员权限实现

管理员权限实现,普通管理员没有添加管理员权限,超级管理员可以添加管理员。
想实现当add.jsp页面中id="cjgly"时执行list.jsp页面的id="cjtj",当add.jsp页面中id="ptgly"时执行list.jsp页面的id="pttj";
这样能实现吗?应该怎么做?看见的大佬能给点意见吗?谢谢

list.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <TITLE>管理员账号查询</TITLE>
    <link rel="stylesheet" href="images/hsgcommon/common.css" type="text/css">
    <link rel="stylesheet" href="images/hsgcommon/div.css" type="text/css">
    <script type="text/javascript" src="scripts/jquery.min.js"></script>
    <script type="text/javascript" src="scripts/cookie_util.js"></script>
    <script type="text/javascript">
    $(function(){
        $("#")
    });
    
    </script>
    <style type="text/css">
    <!--
    body,td,th {
        font-size: 12px;
    }
    -->
    </style>
</head>
<body>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr valign="top">
            <td>
                <table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
                    <tr align="left" bgcolor="#F2FDFF">
                        <td colspan="17" background="images/table_header.gif">管理员账户列表</td>
                    </tr>
                </table>
            </td>
        </tr>
            
        <tr valign="top">
            <td bgcolor="#FFFFFF">
              <table width="100%" border="1" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
                  <tr align="right" bgcolor="#ebf0f7">
                    <td colspan="21">
                        <table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" >
                            <tr align="left" >
                                <td colspan="17">
                                    <form action="allusersList.do" name="myform" method="post">
                                         账号:<input name="username" type="text" id="username" class="form-control2" /> 
                                        <input type="submit" value="查询" class="btn btn-info btn-small"/>
                                        <div id="pttj">
                                        <input type="button" name="Submit" value="添加" class="btn btn-info btn-small" onclick="javascript:location.href='allusers_add.jsp';" disabled="disabled"/>
                                        </div>
                                        <div id="cjtj">

                                        <input type="button" name="Submit" value="添加" class="btn btn-info btn-small" onclick="javascript:location.href='allusers_add.jsp';" />
                                        </div>
                                        
                                    </form>
                                </td>
                            </tr>
                        </table>
                      </td>
                </tr>
                    
    
    </table>
    
    </body>
</html>

 

===============

add.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js" charset="gb2312"></script>
<script type="text/javascript" src="js/popup.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <TITLE>添加管理员账户</TITLE>
        <link rel="stylesheet" href="images/hsgcommon/common.css" type="text/css">
        <link rel="stylesheet" href="images/hsgcommon/div.css" type="text/css">  
    </head>
<%
  String id="";
 %>
<script language="javascript">

function gows()
{
    document.location.href="allusers_add.jsp?id=<%=id%>";
}
function hsgxia2shxurxu(nstr,nwbk)
{
    if (eval("form1."+nwbk).value.indexOf(nstr)>=0)
    {
        eval("form1."+nwbk).value=eval("form1."+nwbk).value.replace(nstr+";", "");
    }
    else
    {
        eval("form1."+nwbk).value=eval("form1."+nwbk).value+nstr+";";
    }
}
</script>
    <body>
        <form action="addAllusers.do" name="form1" method="post">
            <table width="100%" border="1" align="center" cellpadding="3" cellspacing="1"  style="border-collapse:collapse" bgcolor="#F2FDFF">
                <tr bgcolor="#E7E7E7">
                    <td height="20" colspan="2" background="images/table_header.gif">添加管理员账户</td>
                </tr>
                <tr >
                    <td width="200">用户名:</td>
                    <td>
                        <input name='username' type='text' id='username' value='' onblur='hsgcheck()' class="form-control" />&nbsp;*<label id='clabelusername' style="margin-top:16px;" />
                    </td>
                </tr>
                <tr >
                    <td width="200">密码:</td>
                    <td>
                        <input name='pwd' type='text' id='pwd' value='' onblur='checkform()' class="form-control" />&nbsp;*<label id='clabelpwd' style="margin-top:16px;" />
                    </td>
                </tr>
                <tr >
                    <td width="200">权限:</td>
                      <td>
                          <select name="cx" id="cx" class="form-control">
                            
                            <div id="ptgly"><option value="普通管理员">普通管理员</option></div>
                            <div id="cjgly"><option value="超级管理员">超级管理员</option></div>

                        </select>
                      </td>
                </tr>
                <tr align='center'   height="22">
                    <td width="25%" height="45"  align="right">&nbsp;</td>
                    <td width="75%" height="45"  align="left">
                        <input type="submit" name="querenzhuce" id="querenzhuce" value="提交" onClick="return checkform();" class="btn btn-info btn-small" />
                        <input type="reset" value="重置" class="btn btn-info btn-small" />&nbsp;
                    </td>
                </tr>
            </table>
        </form>
   </body>
</html>

  • 写回答

1条回答 默认 最新

  • BCS-点心 2021-04-21 13:13
    关注

    把用户和角色分开,不同的用户登录之后,因为角色不同,能够看到的和使用的功能也不同

     

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 1月19日
  • 已采纳回答 1月11日

悬赏问题

  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题