java - Spring mvc doesn't work post method in form -
when started write application, form submited , createannotation method worked. doesn't work. why? way method executes in controller, , post doesn't.
@controller @requestmapping("/annotation") public class annotationcontroller { @requestmapping(value = "/new", method = requestmethod.post) public string createannotation(@modelattribute annotation annotation, bindingresult result){ annotationservice.create(annotation); return "redirect:/annotation/annotations.htm"; } }
<form action="${pagecontext.request.contextpath}/annotation/new" method="post"> <div class="form-group"> <label for="text">annotation name</label> <input type="text" class="form-control" id="text" placeholder="annotation name" name="name"/> </div> <div class="form-group"> <label for="date">date:</label> <input type="date" class="form-control" id="date" placeholder="date" name="date"/> </div> <div class="form-group"> <label for="comment">description:</label> <textarea class="form-control" rows="5" id="comment" name="description"></textarea> </div> <input type="hidden" name="profil.id" value="1"/> <input type="submit" class="btn btn-default" value="submit"/> </form>
Comments
Post a Comment