重定向素数问题

时间:2018-09-12 12:08:33

标签: javascript php html jsf primefaces

您好,我遇到重定向问题。

我有一个API,当我单击图像时会调用该API,它将获取用户联系电话并通过软件拨打电话。

所有功能都正常运行,但问题是,API重定向到了我不希望的其他页面。

我只想显示通话消息,但焦点应保持在同一页面上。

这是我的xhtml代码

Cell No.
                                            <h:outputText value="#{informationManagerBean.cust.cellNo}" styleClass="textColorChange"/>
                                            Direct Dial

                                            <h:outputLink style="margin: 25px" id="tool_dial"  onclick="PF('callDialog').show();
                                                    {
                                                        return true;
                                                    }" value="http://199.199.333.94/calling.php" >
                                                <img src="Resources/images/dialer.png" alt="NR Letter" align="top" style="margin: 25px"/>
                                                <f:param name="cli"  value="#{informationManagerBean.cust.cellNo}"  />
                                                <f:param name="userid"  value="000001"  />
                                            </h:outputLink>
                                            <p:dialog id="callDialog1" onShow="myFunction();" onHide="myStopFunction();"  header="Calling..."
                                                      width="200px" widgetVar="callDialog"
                                                      position="center" draggable="true" resizable="false" closable="false"
                                                      closeOnEscape="true" appendTo="@(body)" modal="true">


                                            </p:dialog>

这是Java脚本:

<script>
        var myVar;

        function myFunction()
        {
            myVar = setTimeout(function() {
                PF('callDialog').hide()
            }, 3000);
        }

        function myStopFunction()
        {
            clearTimeout(myVar);
        }

    </script>

谢谢

2 个答案:

答案 0 :(得分:1)

h:outputLink应该重定向到另一个uri。我建议您从托管Bean调用http://199.199.333.94/calling.php上的REST api,您可以通过p:commandLinkp:commandButton对其进行引用。 Ajax调用将阻止重定向到api的uri。

编辑:

有关从Java进行http调用的示例,请参见以下内容 How to use java.net.URLConnection to fire and handle HTTP requests

Primefaces commandLink https://www.primefaces.org/showcase/ui/button/commandLink.xhtml

答案 1 :(得分:1)

使用这种功能,您可以将拨号程序从bean中触发

react-native info
相关问题