java - Get input values from Spring Boot Thymeleaf -
i'm attempting retrieve value java class
display error
. there unexpected error
(type=internal server error, status=500). exception evaluating springel expression: "staff.username" (register:22)
this .html file
<div class="form-group"> <label for="username" class="cols-sm-2 control-label">username</label><span class="bg-danger pull-right" th:if="${usernameexists}">username exists</span> <div class="cols-sm-10"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-users fa" aria-hidden="true"></i></span> <input type="text" th:value = "${staff.username}" class="form-control" id="username" name="username" roleid="username" placeholder="enter username" required="required"/> </div> </div> </div>
my controller
@requestmapping(value = "/register", method = requestmethod.get) public string register(model model) { staff staff = new staff(); model.addattribute("staff", staff); return "register"; } @requestmapping(value = "/register", method = requestmethod.post) public void registerpost(@modelattribute("staff") staff staff, model model) { }
Comments
Post a Comment