0

我在 Spring MVC 中实现 HDIV,但在登录页面中遇到了问题。由于 HDIV 需要使用form标签

(如:)<form:form action="${contextPath}/j_spring_security_check" method="post">,我的应用程序会抛出异常,因为我没有指定modelAttribute

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute

任何人都可以澄清这种担忧吗?有没有其他方法可以在登录页面上实现 HDIV?或者有没有办法在不使用的情况下实现 HDIV <form:

4

1 回答 1

2

正如您在HDIV Spring MVC Showcase项目中所见,您不必在登录页面中使用 Spring 的表单标签。

此外,您必须将/j_spring_security_check作为起始页放在hdiv-config.xml

        <hdiv:startPages method="post">/j_spring_security_check</hdiv:startPages>

不要担心可编辑的验证,因为即使 url 是startPage.

于 2015-04-14T14:50:00.653 回答