I am trying to create a simple DB web application using MySQL, JDBC, Netbeans.
I have the following code in a .jsp page
<c:if ${sessionScope.Staff.getStatus() == sessionScope.Staff.financial_staff_status} >
Financial staff
</c:if>
where sessionScope.Staff contains an object of Staff Data type:
public class StaffData
{
//constants
public final byte default_staff_status = 0;
public final byte financial_staff_status = 1;
public final byte legal_staff_status = 2;
public final byte secretarial_staff_status = 3;
//other data
StaffData()
{
//initializations
}
void authenticate(int staff_num, String passwd) throws ClassNotFoundException, SQLException
{
//connect to sever, blah, blah
}
public String getName()
{
return this.name;
}
public int getNumber()
{
return this.staff_number;
}
public byte getStatus()
{
return this.status;
}
}
I am setting the session object in advance:
request.getSession().setAttribute("Staff", currentStaff);
I am getting the following error:
javax.el.PropertyNotFoundException: Property 'financial_staff_status' not found on type staff.StaffData
In the staff data object in the session, public methods such as getName() can be accessed, but public members such as financial_staff_status cannot.
Why am I getting this problem? The problem seems to be with the final variables. Non final variables can easily be accessed without a problem.