I want to use the if statement in the jsp file to display a button when the conditions match.

Asked 1 years ago, Updated 1 years ago, 41 views

"I would like to display the ""Like Cancel"" button when the values ""sessionScope.login_employee.id"" and ""reportfavo.employee.id"" are equal in the following code."
"When I checked the values of ""sessionScope.login_employee.id"" and ""reportfavo.employee.id"", the values were the same, but the ""like cancel button"" does not appear."Could you please let me know if there is anything wrong?

<c:if test="${sessionScope.login_employee.id==reportfavo.employee.id}">
            <form method="POST" action="<c:url value='/reports/destroy'/>">
                <p align="justify">
                    <input type="hidden" name="report_id" value="${report.id}"/>
                    <button type="submit">Cancel Like</button>
                </p>
            </form>
        </c: if>

java

2022-09-30 21:42

1 Answers

From the code above

<c:if test="${sessionScope.login_employee.id==reportfavo.employee.id}">

and

</c:if>

If the button does not appear when is turned off, it is not a branch condition (c:if).

If it is a c:if issue, add the following two lines to see if they really match.

<c:out value="${sessionScope.login_employee.id}"/>
<c:out value="${reportfavo.employee.id}"/>


2022-09-30 21:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.