title: Hide list item based on boolean true false jsp
body: <p>I have a slide menu in my jsp Page and After login, I am checking whether user is allowed to view element or not from parameters stored in the database. I need to hide the items based on whether the user is allowed to view or not.</p>
  
  <p>My jsp</p>
  
  <pre><code>&lt;ul  style = "display:none"&gt;
  &lt;li&gt;&lt;a href="servletName"&gt;MyfirstSubmenu&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="servletName1"&gt;MyfirstSubmenu1&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>My dao:extract:</p>
  
  <pre><code>public boolean userallowed(username, itemid){
  ..........................
  return true;
  }
  </code></pre>
  
  <p>my servlet extract:</p>
  
  <pre><code>if(userallowed(username, itemid)){
    session.setAttribute("userallowed", true);
    request.getRequestDispatcher("/mypage.jsp").forward(request, response);
  }else{
    request.getRequestDispatcher("/mypage.jsp").forward(request, response);
    session.setAttribute("userallowed", false);
  }
  </code></pre>
  
  <p>How Can I write a javascript Function to able to hide elements based on user permissions?</p>