Spring中有哪些模板引擎,类似于laravel中的Blade?
我是Spring的新手,我搜索了模板引擎,但只找到了Jtwig,虽然它看起来更像是一组函数.
我需要像刀片一样,生成带有标题,内容,页脚的模板,包括其他视图等等.谢谢
我真的开始使用我的小应用程序的控制器,我现在有这个:
@RequestMapping("/users/{id}")
public ModelAndView showMemeber(@PathVariable Integer id) {
ModelAndView mav = new ModelAndView("user/show");
mav.addObject("title", "Show User");
mav.addObject("user", userService.findById(id));
return mav;
}
@RequestMapping(value="/users/{id}", method=RequestMethod.DELETE)
public String deleteMemeber(@PathVariable Integer id) {
userService.delete(id);
return "redirect:users";
}
Run Code Online (Sandbox Code Playgroud)
第一个,工作正常,但第二个没有,我有第一个控制器的以下视图:
<div class="panel-heading">Personal information</div>
<div class="panel-body">
<form method="post">
...
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-pencil"></span> Edit</button>
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete {{ user.username }}?')"><span class="glyphicon glyphicon-remove"></span> Delete</button>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
就像你看到的,我这里有两个按钮,一个用于编辑对象,一个用于删除它.删除后,必须重定向到https://<my domain>/users.
问题是,当我点击Delete它只是刷新页面并且对象在数据库上持久存在时,这里有什么问题?
DELETE …