spring mvc - How to check JAVA variable ${account} in jsp? -


i have dropdown-menu, , want check if ${uaccount} equals admin show users_info item

i don't konw how write in jsp . please guide me

                <ul class="dropdown-menu dropdown-user">                 <%if(${uaccount}).equals('admin')){ %>                     <li><a href="users_info">user info</a></li>                               <%} %>                     <li><a href="${pagecontext.request.contextpath}/logout">logout</a></li>                 </ul>  

first make sure have jstl library in classpath, import jsp page with:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 

now can compare string in jsp with:

<ul class="dropdown-menu dropdown-user"> <c:if test="${uaccount == 'admin'}">    <li><a href="users_info">user info</a></li>               </c:if> <li><a href="${pagecontext.request.contextpath}/logout">logout</a></li> </ul>  

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -