2

I have a very strange problem, I have a useBean loginCheck which is stored in session and I want to use it to display a different menu according to the user logged. So here is my code in the JSP :

<jsp:useBean id="loginTest" type="java.lang.String" scope="session"/>
...
...
...
<ul id="menu">
  
  <li><a href="<%=adresseIP.adressePage %>derogcontroller?lien=demandederog">Faire une demande de dérogations</a></li>
 
  <li><a href="<%=adresseIP.adressePage %>derogcontroller?lien=listedemandes&demandeur=user">Voir mes demandes</a></li>
  
  <%if(loginTest.equals("admin")){ %><li><a href="<%=adresseIP.adressePage %>derogcontroller?lien=utilisateur">Espace admin</a></li><%} %>
  
  <%if(loginTest.equals("manager")){ %><li><a href="<%=adresseIP.adressePage %>derogcontroller?lien=utilisateur">Manager</a></li><%} %>
  
  <%if(loginTest.equals("paie")){ %><li><a href="<%=adresseIP.adressePage %>derogcontroller?lien=utilisateur">Paie/Poste</a></li><%} %>
  
</ul>

When I run into this page the first time I have a page completely blank, no error, no logs, nothing. Then I run the page without the menu and the useBean, so it works great, I can see the rest of the page. And then I put back my useBean and my menu and here, it works, I can see the menu with the good link according to the user.

I'm very confused because my code works but only when I remove the code, access to the page, put back the code and refresh. Any idea about this problem ?

Roman C
  • 49,761
  • 33
  • 66
  • 176
Simon M.
  • 2,244
  • 3
  • 17
  • 34
  • Does the `class` attribute is missing in your `` tag? Maybe like `< jsp:useBean id="loginTest" class="com.sample.Login" scope="session" />` – Vinoth Krishnan Mar 02 '16 at 09:58

1 Answers1

0

The part that is useBean is required, because without it the rest of the code doesn't work.

When you modify the code of JSP page you need to rebuild, redeploy this page or your application to make the changes effect.

Roman C
  • 49,761
  • 33
  • 66
  • 176