【问题标题】:JSF navigation not working in RichFacesJSF 导航在 RichFaces 中不起作用
【发布时间】:2011-06-06 16:45:04
【问题描述】:

我有我认为是简单的 JSF 导航设置,但是当我点击 h:commandButton 时,页面重新加载,而不是我想要加载的页面。 faces-config sn-p 在这里:

    <navigation-rule>
    <from-view-id>/index.jsf</from-view-id>
    <navigation-case>
        <from-outcome>hello</from-outcome>
        <to-view-id>/next.jsf</to-view-id>
    </navigation-case>
</navigation-rule>

index.xhtml 文件包含以下内容:

<f:view>
    <a4j:region id="topRegion">
        <rich:page pageTitle="myapp" markupType="xhtml" id="top">
<f:facet name="header">
<h:form>
    <rich:toolBar height="45" itemSeparator="disc">
        <rich:toolBarGroup location="left">
            <h:form name="selectForm">
                <h:panelGrid columns="5" style="padding: 2px;">
                    <h:outputText style="text-align: center" value="Node Select " />
                    <h:selectOneMenu id="nodes" value="#{MyBacking.chosenNode}">
                        <f:selectItems value="#{MyBacking.nodes}" />
                    </h:selectOneMenu>

                    <h:commandButton value="Retrieve" styleClass="ctrlBtn"
                        id="retrieveBtn" style="margin-bottom: 2px;"
                        action="hello"
                        image="/img/btnRetrieve26.png" />
                </h:panelGrid>
            </h:form>
        </rich:toolBarGroup>
    </rich:toolBar>
</h:form>

就这么简单。谁能告诉我为什么它不起作用?

据我所知,h:commandbutton 应该使用 hello 的 from-outcome 并加载 next.xhtml 文件。

【问题讨论】:

    标签: jsf richfaces


    【解决方案1】:

    您的文件是 .xhtml 而不是 .jsf

    你试过了吗:

    <navigation-rule>
        <from-view-id>/index.xhtml</from-view-id>
        <navigation-case>
            <from-outcome>hello</from-outcome>
            <to-view-id>/next.xhtml</to-view-id>
        </navigation-case>
    </navigation-rule>
    

    【讨论】:

    • 好伤心。你说得对。我的困惑来自于我习惯于指定 *.jsf 的 url 模式和 .xhtml 的 DEFAULT_SUFFIX 的 Web 描述符。干杯!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-30
    • 2011-11-26
    • 2011-05-17
    • 2012-02-20
    • 1970-01-01
    • 2011-12-25
    • 2016-11-04
    相关资源
    最近更新 更多