【问题标题】:Webflow binding failureWebflow绑定失败
【发布时间】:2013-10-02 20:56:05
【问题描述】:

我正在尝试将忘记密码路径添加到现有视图。我在我的 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" />

【问题讨论】:

  • 有一个forgotPasswordBean 而不是forgotPassword。因此,要么将&lt;form:form ... &gt; 标记更改为引用forgotPasswordBean,要么将名称更改为forgotPassword
  • @M.Deinum 那会是
    吗?
  • modelAttributecommandName 任何一个都可以。
  • @M.Deinum Brilliant。如果您将其发布为答案,我将投票并标记为正确。谢谢!

标签: java spring spring-webflow cas spring-webflow-2


【解决方案1】:

您的&lt;form:form ... &gt; 标签应该引用正确的bean。您的配置提到了forgotPasswordBean 而不是forgotPassword

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

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

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

<var name="forgotPassword" class="com.mycompany.authentication.ForgotPasswordBean" />

【讨论】:

    猜你喜欢
    • 2012-01-14
    • 2012-02-25
    • 2015-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-06
    • 2013-08-16
    • 2015-11-30
    相关资源
    最近更新 更多