I know this may look like a duplicate question. Unfortunately there is no acceptable, working answer. Even the OP was facing a different issue, not what the question it says.
POJO class below :
private boolean admin = false;
private boolean isNormal = false;
public void setAdmin(boolean admin) {
this.admin = admin;
}
public boolean getAdmin() {
return admin;
}
public void setIsNormal(boolean isNormal) {
this.isNormal= isNormal;
}
public boolean getIsNormal() {
return isNormal;
}
// In this class I have many boolean flags like above two. I need to access those in the my JSP
Servlet code below :
System.out.println(responseHeader.getAdmin()); //printed 'True'
session.setAttribute("header", responseHeader);
request.getRequestDispatcher("/DashBoard/Shipper").forward(request, response);
JSP below code :
<%StaticHeader sh = (StaticHeader)session.getAttribute("header");//getting the StaticHeader Object from the session
pageContext.setAttribute("headerFromSession",sh); // set the StaticHeader Object again into PageContext (may be unnecessary):
%>
None of these below scenarios didn't work and I didn't get any Exceptions either.
1.) <c:if test="${headerFromSession.getAdmin()}"> //seems to be standard, formal way. But it didn't work
2.) <c:if test="${headerFromSession.Admin}"> // Is this legal? I mean, 'admin' is a private variable.
3.) <c:if test="${headerFromSession.ADMIN}">
4.) <c:if test="${headerFromSession[Admin]}">
5.) <c:if test="${headerFromSession[ADMIN]}">
6.) <c:if test="${headerFromSession}"> //This seems like totally not correct. Because I have many boolean flages which I have already set to the StaticHeader Object