spring - Thymeleaf - Conditional Attributes only showing for a split second in html -
i working on spring web application. tried write function checks whether if entered password correct. code controller:
@requestmapping(value = "/login", method = requestmethod.post) public modelandview loginuser(@modelattribute user user) throws filenotfoundexception { if (patient.getpasswort().equals(patient.getpasswortconfirm())) { service.login(user); modelandview modelandview = new modelandview("mainpage"); modelandview.addobject("user", user); return modelandview; } else { modelandview modelandview = new modelandview("login"); modelandview.addobject("wrongpw", true); return modelandview; } }
this code html page:
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> <head> <link rel="shortcut icon" type="image/ico" href="image/favicon.ico" /> <meta charset="utf-8" /> <link rel="stylesheet" href="css/main.css" /> <script src="lib/jquery-2.1.4.js"></script> </head> <body> <div id="menuebg"></div> <p th:if="${wrongpw}"><font color="red">password wrong</font></p> <div id="menue"> <form action="01erstellen" method="post" th:object="${patient}"> <table border="0px"> <tr height="20px"> <td>name: <input th:field="*{nachname}" onchange="namelive();" type="text" id="txtname" value="" /> </td> </tr> <tr height="20px"> <td>vorname: <input th:field="*{vorname}" onchange="vornamelive();" type="text" id="txtvorname" value="" /> </td> </tr> <tr height="20px"> <td>email: <input th:field="*{email}" type="text" /> </td> </tr> <tr height="20px"> <td><label for="gebdat"> geburtsdatum: <input th:field="*{geburtstag}" type="date" id="gebdat" /> </label></td> </tr> <tr height="20px"> <td><label for="passwd">passwort: <input th:field="*{passwort}" type="password" id="passwd" size="20" maxlength="40" /> </label></td> </tr> <tr height="20px"> <td><label for="passwd-confirm">wiederholen: <input th:field="*{passwortconfirm}" type="password" id="passwd-confirm" size="20" maxlength="40" /> </label></td> </tr> <tr height="20px"> <td></td> </tr> <tr height="20px"> <td> <br/> <input id="btn-send" type="submit" value="finish" /> </td> </tr> <tr height="20px"> <td></td> </tr> </table> </form> </div> </body> </html>
my problem if type in wrong password text shows split second disappears. can me? thank you!
Comments
Post a Comment