【问题标题】:Rich:modalpanel Wizard behaviour doesn't workRich:modalpanel 向导行为不起作用
【发布时间】:2012-12-03 07:50:12
【问题描述】:

我在 Rich:modal 面板中的类似向导的行为有问题。 我已经阅读了教程和这个http://maxkatz.sys-con.com/node/1428854/mobile 和这个http://www.mkyong.com/jsf2/jsf-form-action-navigation-rule-example/。但他们都没有任何帮助。 我的代码如下:

面孔配置:

    <!-- WizardProject -->
    <navigation-rule>
    <from-view-id>/widgets/wizard/ProjectStep.xhtml</from-view-id>
    <navigation-case>
        <from-action>#{projectWizard.goNext}</from-action>
        <from-outcome>SUCCESS</from-outcome>
        <to-view-id>/widgets/wizard/InfoStep.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-action>#{projectWizard.goNext}</from-action>
        <from-outcome>FAIL</from-outcome>
        <to-view-id>/widgets/wizard/InfoStep.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>

我的 Richpanel:

<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:rich="http://richfaces.org/rich">

<!-- 
    Parameters:
        id - modal dialog id
        bean 
        src - firstWizardPage
 -->

 <rich:modalPanel id="#{id}" width="750" resizeable="false" autosized="true">

      <f:facet name="header">
        <h:panelGroup>
                <h:outputText  value="Wizard"/>
        </h:panelGroup>
      </f:facet>
      <h:form>
        <h:panelGroup id="test">
            <a4j:include id="wizardPage" viewId="#{src}"/>
        </h:panelGroup>
      </h:form>
    </rich:modalPanel>
</ui:composition>

模态面板正确获取参数。第一个页面打开,然后调用 bean。

这是第一页 - ProjectStep.xhtml

<h:panelGroup xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich"
    xmlns:c="http://java.sun.com/jstl/core">


        <h:outputText value="I've opened up #{bean}" />
        <h:inputText value=" " />
        <div class="actionButtons">
        <div class="actionCancelButtons">
          <a4j:commandButton id="btnNext" 
                             value="Next" 
                             action="#{bean.goNext()}"
                             style="display:#{bean.isCanGoNext() ? '' : 'none'}"
                             reRender="test"/>

            <a4j:region>
            <a4j:commandButton  onclick="#{rich:component(id)}.hide()" 
                                value="Cancel" 
                                style="display:#{bean.isCanCancel() ? '' : 'none'}"/>
            </a4j:region>
        </div>
        </div>




</h:panelGroup>

我尝试使用 ui:composition 而不是 h:panelGroup。它没有用。第二页以同样的方式实现。

当我单击下一步时,我的 bean 返回 SUCCESS 消息,但页面没有改变。

请问有没有人知道怎么回事?

【问题讨论】:

    标签: java richfaces wizard


    【解决方案1】:

    &lt;redirect/&gt; 属性添加到您的 faces_config.xml 中,并可能在您的&lt;a4j:include/&gt; 上尝试ajaxRendered="true"绝对确保您的导航案例正在被调用。您的 faces_config 应该是这样的

     <navigation-rule>
        <from-view-id>/widgets/wizard/ProjectStep.xhtml</from-view-id>
        <navigation-case>
            <from-action>#{projectWizard.goNext}</from-action>
            <from-outcome>SUCCESS</from-outcome>
            <to-view-id>/widgets/wizard/InfoStep.xhtml</to-view-id>
            <redirect/>
        </navigation-case>
        <navigation-case>
            <from-action>#{projectWizard.goNext}</from-action>
            <from-outcome>FAIL</from-outcome>
            <to-view-id>/widgets/wizard/InfoStep.xhtml</to-view-id>
            <redirect/>
        </navigation-case>
    </navigation-rule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-09
      • 2016-12-02
      • 1970-01-01
      • 1970-01-01
      • 2018-08-16
      • 1970-01-01
      相关资源
      最近更新 更多