我正在尝试将忘记密码路径添加到现有视图中。我在我的webflow中创建了一个新的视图,动作,模型bean和一些状态。我没有看到视图,而是继续收到错误java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'forgotPassword' available as request attribute
。我知道bean存在,它应该是可见的。我认为我正确设置了网络流,但我不是百分百肯定。有谁知道我可能做错了什么?
casLoginView.jsp:
<a href="/cas/login?execution=${flowExecutionKey}&_eventId=forgotPassword">Forgot Password</a>
登录-webflow.xml:
<var name="credentials" class="org.jasig.cas.authentication.principal.UsernamePasswordCredentials" />
<var name="forgotPasswordBean" class="com.mycompany.authentication.ForgotPasswordBean" />
<view-state id="viewLoginForm" view="casLoginView" model="credentials">
<binder>
<binding property="username" />
<binding property="password" />
</binder>
<on-entry>
<set name="viewScope.commandName" value="'credentials'" />
</on-entry>
<transition on="submit" bind="true" validate="true" to="realSubmit">
<evaluate expression="authenticationViaFormAction.doBind(flowRequestContext, flowScope.credentials)" />
</transition>
<transition on="forgotPassword" bind="false" validate="false" to="forgotPasswordView"/>
</view-state>
<view-state id="forgotPasswordView" view="myForgotPasswordView.jsp" model="forgotPasswordBean">
<binder>
<binding property="username" required="true"/>
</binder>
<transition on="submit" to="forgotPassword"/>
</view-state>
<action-state id="forgotPassword">
<evaluate expression="forgotPasswordAction.submit(flowScope.forgotPasswordBean)" />
<transition on="success" to="newPasswordSentView"/>
<transition on="forbidden" to="forgotPasswordForbiddenView"/>
<transition on="error" to="forgotPasswordView"/>
</action-state>
<end-state id="newPasswordSentView" view="myNewPasswordSentView" />
<end-state id="forgotPasswordForbiddenView" view="forgotPasswordForbiddenView" />
答案 0 :(得分:3)
您的<form:form ... >
标记应引用正确的bean。您的配置提到forgotPasswordBean
而不是forgotPassword
。
您的表单对象应引用正确的bean
<form:form modelAttribute="forgotPasswordBean" ... >
或者您应该在webflow配置中重命名bean(包括对它的所有引用)。
<var name="forgotPassword" class="com.mycompany.authentication.ForgotPasswordBean" />