Which JSP code snippet should be used to make this menu visible to the user?

You are building JSP pages that have a set of menus that are visible based on a user’s security
role. These menus are hand-crafted by your web design team; for example, the SalesManager
role has a menu in the file /WEB-INF/html/sales-mgr-menu.html. Which JSP code snippet should
be used to make this menu visible to the user?

You are building JSP pages that have a set of menus that are visible based on a user’s security
role. These menus are hand-crafted by your web design team; for example, the SalesManager
role has a menu in the file /WEB-INF/html/sales-mgr-menu.html. Which JSP code snippet should
be used to make this menu visible to the user?

A.
<% if ( request.isUserInRole(“SalesManager”) ) { %>
<%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %>
<% } %>

B.
<jsp:if test=’request.isUserInRole(“SalesManager”)’>
<%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %>
</jsp:if>

C.
<% if ( request.isUserInRole(“SalesManager”) ) { %>
<jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ />
<% } %>

D.
<jsp:if test=’request.isUserInRole(“SalesManager”)’>
<jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ />
</jsp:if>

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *