【问题标题】:redirect to another page after some seconds jsf2 primefaces几秒钟后重定向到另一个页面 jsf2 primefaces
【发布时间】:2012-08-11 16:38:40
【问题描述】:

我有一个允许编辑用户的页面,当用户单击“编辑”按钮时,我将他重定向到另一个页面几秒钟,我想再次将他重定向到另一个页面,但这次一劳永逸, 我尝试使用<p:poll>

但它不起作用 这是我的代码:

 <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./template_admin.xhtml">

            <ui:define name="content">
                <h:form id="form">

                            <p:panel id="panel" header="Confirmation" style="width: 400px;margin: auto;" >

                                <h:panelGrid columns="1">
                                    <h:outputText value="votre edition est sauvegardé avec succée"/>
                                    <h:outputText value="vous serez rediriger vers la page de la liste des utilisateurs dans quelques instants" />
                                    <p:poll interval="3" action="utilsateurs" />
                                </h:panelGrid>


                            </p:panel>

                        </h:form>

            </ui:define>

        </ui:composition>

    </body>
</html>

你有什么想法吗 提前谢谢你

【问题讨论】:

    标签: jakarta-ee jsf-2 primefaces


    【解决方案1】:

    您不需要投票。你可以用纯html来做。将此标签添加到页面头部

    <meta http-equiv="refresh" content="5;URL=otherUrl.jsf" />
    

    这将在 5 秒后重定向到“otherUrl.jsf”。由于您使用的是模板,也许您可​​以在标题中添加一个 ui:insert,这样您就可以从模板客户端将元数据插入到标题中。

    【讨论】:

    • 感谢您的回复,但正如您所见,我使用 facelet 模板和 facelet 模板客户端,我在此页面中没有 head,我只有 facelet 中的 h:head模板
    • @user1581868 这正是我告诉你在模板的标题中添加一个 ui:insert 的原因,在模板客户端中,你使用 ui:include 并将元标记放在那里
    • 好的,你说得对,这个我没注意,谢谢
    猜你喜欢
    • 1970-01-01
    • 2012-06-26
    • 1970-01-01
    • 1970-01-01
    • 2011-06-02
    • 2016-10-16
    • 1970-01-01
    • 2014-09-02
    • 1970-01-01
    相关资源
    最近更新 更多