How to show options according to a user profile

0

Please could you help me, I need to show the options of a system created in jsp, I need to show the options according to the profile that the user has.

my menu has several options and I want it to only show the ones that correspond to profiles ADMINISTRATOR AND USER

Here jsp code of the menu.

<input type="text" name="txtperfil" value="ADMINISTRADOR" class="form-control">

<%
String perfil=request.getParameter("txtperfil");
try
{
    if(perfil.equals("ADMINISTRADOR"))
    {
        %>

<footer class="page-footer row cyan darken-1">
      <div class="container">
        <div class="row">

          <div class="span12 tabbable">
            <h5 class="white-text"></h5>

            <ul class="nav nav-tabs">
                <li><a href="barraCentral.jsp" data-toggle="tab" target="centro"><span class="glyphicon glyphicon-th-list"></span> Menu</a></li>
            </ul>

            <ul class="nav nav-tabs">
                <li><a href="solicitudes.jsp" data-toggle="tab" target="centro"><span class="glyphicon glyphicon-pencil"></span> Solicitudes</a></li>
            </ul>

            <ul class="nav nav-tabs">
              <li><a href="administradorVuelos.jsp" data-toggle="tab" target="centro"><span class="glyphicon glyphicon-plane"></span> Administrador de Carga</a></li>
            </ul >

            <ul class="nav nav-tabs">
            <li><a href="reportes.jsp" data-toggle="tab" target="centro"><span class="glyphicon glyphicon-list-alt"></span> Administrador Reportes</a></li>
            </ul >

            <ul class="nav nav-tabs">
            <li><a href="administradorCarga.jsp" data-toggle="tab" target="centro"><span class="glyphicon glyphicon-signal"></span> Graficos</a></li>
            </ul > 

            <ul class="nav nav-tabs">
                <li><a href="mantenedores.jsp" data-toggle="tab" target="centro">Mantenedores</a></li>
            </ul>

          </div>

        </div>

      </div>

</footer>

<%
    }
    else
    {
        if(perfil.equals("USUARIO"))
        {
            %>
<footer class="page-footer row cyan darken-1">
      <div class="container">
        <div class="row">

          <div class="span12 tabbable">
            <h5 class="white-text"></h5>

            <ul class="nav nav-tabs">
                <li><a href="barraCentral.jsp" data-toggle="tab" target="centro"><span class="glyphicon glyphicon-th-list"></span> Menu</a></li>
            </ul>

            <ul class="nav nav-tabs">
                <li><a href="solicitudes.jsp" data-toggle="tab" target="centro"><span class="glyphicon glyphicon-pencil"></span> Solicitudes</a></li>
            </ul>

          </div>

        </div>

      </div>

</footer>

<%
        }
    }
}
catch(NullPointerException ex)
{
    ex.getMessage();
}
%>

but it does not hide the options to me and disappears all the menu

here the menu with all the options the Menu and Requests option must be displayed for the USER profile and for the ADMINISTRATOR profile All options should be displayed

    
asked by Simón Pereira Vigouroux 06.09.2018 в 22:31
source

0 answers