I tried some code to make disable-enable button by condition, but it apparently not working as I want:
<form method="get" action="reg.jsp">
<%
if ((String)session.getAttribute("dept") == "HR") {
%>
<th colspan="1"><input type="submit" value="Register"/></th>
<% }
else {
%>
<th colspan="1"><input type="submit" value="Register" disabled></th>
<th><%= session.getAttribute("dept")%></th>
<%
}
%>
</form>
And it works like this:
button-unable
The "register" button supposed to be enable when the "department" is "HR".
Please help me to spot what I missed.. :(