0
我是JSP和Java中的新成員。我想執行一段代碼,如果按下複選框,它將顯示或隱藏內容。我正在這樣想:如果按複選框,布爾變量將變爲true。如果布爾變量爲true,則執行另一個if語句。如果在JSP中選中複選框,則顯示/隱藏內容
但是在我的最終結果中,我的所有內容都是隱藏的。有人可以向我解釋爲什麼會發生這種情況,或者給我另一種方式來做到這一點?
<%boolean hide = false;
String strCheckBoxValue= (String) session.getAttribute("checkweekends");
if (strCheckBoxValue != null) {
hide = true;
} %>
<c:if test="${hide == true}">
<c:if test="${a.dateFormat_hideweekends(day+z) !=''}">
<c:if test="${a.getData(time,day+z, sala)!=''}">
<TD align="center" valign="middle" width="100" title="${a.getData(time,day+z, sala)}" style="color:#00008B;text-overflow: ellipsis;width: 200px;white-space: nowrap;overflow: hidden;" bgcolor="#FFFF00">
<c:out value="${a.getData(time,day+z, sala)}" />
</TD>
</c:if>
<c:if test="${a.getData(time,day+z, sala)==''}">
<TD align="center" valign="middle" width="100" bgcolor="#90EE90">
</TD>
</c:if>
</c:if>
</c:if>