I have a next question. In jsp page I use menu for 2 users ( tutor and student) in dependence on role I choose which from menu files I should include. Smth like this
<c:if test="${role eq 'Tutor'}">
<c:import url="/page/menuForTutor.html" charEncoding="UTF-8"/>
</c:if>
<c:if test="${role eq 'Student'}">
<c:import url="/page/menuForStudent.html" charEncoding="UTF-8"/>
</c:if>
I should use user descriptor
public class MenuTag extends TagSupport{
private static final String PARAM_ROLE_TUTOR = "Tutor";
private static final String PARAM_ROLE_STUDENT = "Student";
@Override
public int doStartTag(){
HttpServletRequest request = (HttpServletRequest)pageContext.
getRequest();
HttpSession session = request.getSession();
String role = (String) session.getAttribute("role");
if (PARAM_ROLE_TUTOR.equals(role)){
try {
pageContext.getOut().print("<c:import url=\"/page/menuForTutor.html\" charEncoding=\"UTF-8\"/>");
} catch (IOException ex) {
Logger.getLogger(MenuTag.class.getName()).log(Level.SEVERE, null, ex);
}
} else if(PARAM_ROLE_STUDENT.equals(role)){
}
return SKIP_BODY;
}
}
When I use debag I see that I do all steps but menu for tutor wasn't showed on jsp. Any ideas?