我使用最新版本的Thymeleaf和Spring Boot项目。我遇到一个非常奇怪的问题,当我在元素标记中使用autofocus
或required
属性时,我发出了stackoverflow错误。我正在使用最新版本的Twitter Bootstrap
项目。在我的项目中,我使用:Spring Security,ThymeLeaf和Twitter Bootstrap。配置使用Java Configuration完成。下面是生成stackoverflow的代码。如果我删除autofocus
和required
属性,则应用程序运行正常。
<form class="form-signin" role="form">
<h2 class="form-signin-heading">Please sign in</h2>
<input type="email" class="form-control" placeholder="Email address" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
<label class="checkbox">
<input type="checkbox" value="remember-me"> Remember me
</label>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
答案 0 :(得分:1)
Thymeleaf需要XML合规性。这意味着关闭标签和带有值的属性。您可以使用:
required="required" autofocus="autofocus"
添加答案,巴特的回应帮助了我。