java - how to prevent deletion of current log in user in JSP page or HTML -
this jsp code delete button. dont want delete current login user. jsp code delete button. dont want delete current login user.
<table border="1"> <thead style="background: #0086b2;"> <tr> <th></th> <th>sl no.</th> <th>user name</th> <th>phone number</th> <th>email id</th> <th>login id</th> </tr> </thead> <c:if test="${userlist!=null}"> <c:foreach items="${userlist}" var="user"> <tr> <td><input type="checkbox" name="deleteval" value="${user.slno}"></td> <td>${user.slno}</td> <td>${user.username}</td> <td>${user.emailid}</td> <td>${user.phonenumber}</td> <td>${user.loginid}</td> </tr> </c:foreach> </c:if> </table> <br> <table> <tr> <td><input type="button" value="delete"></td> <tr> </table
you can this:
<table border="1"> <thead style="background: #0086b2;"> <tr> <th></th> <th>sl no.</th> <th>user name</th> <th>phone number</th> <th>email id</th> <th>login id</th> <th>delete</th> </tr> </thead> <c:if test="${userlist!=null}"> <c:foreach items="${userlist}" var="user"> <tr> <td><input type="checkbox" name="deleteval" value="${user.slno}"></td> <td>${user.slno}</td> <td>${user.username}</td> <td>${user.emailid}</td> <td>${user.phonenumber}</td> <td>${user.loginid}</td> <c:if test="${user.slno != (user id session)}"> <td><input type="button" value="delete" onclick="delete(${user.slno})"></td> </c:if> </c:foreach> </c:if> </table> logic if current user id equals user id in list, don't show delete button.
java html mysql jsp
No comments:
Post a Comment