您好,我遇到了重定向问题。
我有一个 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>
谢谢
最佳答案
使用这样的函数,您可以从 bean 中触发拨号器
public int doCall(String cli, String userid) {
HttpURLConnection conn = (HttpURLConnection) new URL("http://199.199.333.94/calling.php?cli="+cli+"&userid="+userid).openConnection();
conn.setDoOutput(false);
int responseCode = conn.getResponseCode();
conn.disconnect();
return responseCode;
}
关于javascript - 在 primefaces 问题中重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52294820/