如何根据用户角色隐藏java中的选项卡 [英] How to hide a tab in java based on the user role

查看:72
本文介绍了如何根据用户角色隐藏java中的选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

In my application I have three listitems File Upload,View Reports and Change Password. I need to hide View Reports if the login is by normal user and i need to display View Reports if the login is by manager. Below is the code of my tabs

Code in master page-

<div class="wrapper">
        <div class="menu">
             <div class="menu">
                <ul id="drop-nav">
                    <li id="MenuFileUpload" runat="server"><a href="Upload.jsp">File Upload</a>
                        <ul>
                            <li><a href="ViewUploadedFiles.jsp">View Uploaded Data</a></li>
                        </ul>
                    </li>
                     <li id="MenuReports" runat="server"><a href="Reports.jsp" id="Rpf" runat="server">View Reports</a><ul>
                         <li><a href="Reports1.jsp">Report1</a></li>
                         <li><a href="Reports2.jsp">Reports2</a></li>
                         <li><a href="Report3.jsp">Report3</a></li>
                         </ul>
                     </li>
                         <li id="lichangepwd" runat="server"><a id="A1" href="ChangePassword.jsp" runat="server">Change Password</a></li>
                    <div style="width:auto;float:right;font-weight:bold;padding-right:0cm;">
                        <li id="lilogout"><a href="Logout.jsp"> Logout</a></li></div>
                     <div style="float: left;text-align:right; width: 64%;"> 
                    <asp:Label ID="lblmsg" runat="server" ForeColor="Red" BorderColor="White" Text="Label" Font-Size="Small"></asp:Label> </div>

                </ul>

             </div>

        </div>

code in login page-

if(role.equals("Supervisor"))
{
reports.visible=false; 
}


I had tried by making reports.visible=false; which we will do in .net but its not working in java





我尝试了什么:





What I have tried:

I had tried by making reports.visible=false; which we will do in .net but its not working in java

推荐答案

尝试使用样式属性,如 HTML DOM样式可见性属性 [ ^ ]。
Try using the style attribute, as described at HTML DOM Style visibility Property[^].


这篇关于如何根据用户角色隐藏java中的选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆