jsp页面接收一个可以有四个值的枚举变量
public enum userType
{
manager,HOD,consultant,support;
}
jsp页面有两个div,第一个div只有在enum变量为 support 时才可见。 无论usertype如何,第二个div应始终可见。 这就是我所做的,我得到一个没有输出的屏幕。
<c:if test= "${(usertype.toString().equals(support)) == false}">
<div id ="supportOnly" style = "display:none">
<form action ="newquery.jsp" method="post">
<%
//the userID variable is sent to the next page
session.setAttribute("userID", userID);
%>
<input type="submit" value="New Query">
</form>
</div>
</c:if>
<%--
the form below is used to search for a query
all users may search for queries
--%>
<c:if test ="${(usertype.toString().equals(support)) || (usertype.toString().equals(consultant))|| (usertype.toString().equals(HOD)) || (usertype.toString().equals(Manager))}">
<div id ="allUsers">
<form action ="searchquery.jsp" method="post">
<%
//the userID variable is sent to the next page
session.setAttribute("userID", userID);
%>
<input type="submit" value="View Query">
</form>
</div>
</c:if>