-1

我正在尝试将忘记密码路径添加到现有视图。我在我的 webflow 中创建了一个新的视图、动作、模型 bean 和一些状态。我没有看到视图,而是不断收到错误消息java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'forgotPassword' available as request attribute。我知道 bean 存在,它应该是可见的。我我正确设置了 webflow,但我不是 100% 确定。有人知道我可能做错了什么吗?

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" />
4

1 回答 1

3

您的<form:form ... >标签应该引用正确的 bean。您的配置提到了一个forgotPasswordBean而不是forgotPassword一个。

您的表单对象应该引用正确的 bean

<form:form modelAttribute="forgotPasswordBean" ... >

或者你应该在你的 webflow 配置中重命名 bean(包括对它的所有引用)。

<var name="forgotPassword" class="com.mycompany.authentication.ForgotPasswordBean" />
于 2013-09-26T18:43:48.243 回答