在 primefaces 问题中重定向
Redirect in primefaces Issue
您好,我遇到了重定向问题。
我有一个 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>
谢谢
h:outputLink
应该重定向到另一个 uri。我建议您从可以通过 p:commandLink
或 p:commandButton
引用的托管 bean 调用 http://199.199.333.94/calling.php 上的 REST api。 ajax 调用将阻止重定向到 api 的 uri。
编辑:
请参阅以下有关从 java 进行 http 调用的示例
Primefaces 命令链接 https://www.primefaces.org/showcase/ui/button/commandLink.xhtml
使用这样的功能,您可以从 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;
}
您好,我遇到了重定向问题。
我有一个 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>
谢谢
h:outputLink
应该重定向到另一个 uri。我建议您从可以通过 p:commandLink
或 p:commandButton
引用的托管 bean 调用 http://199.199.333.94/calling.php 上的 REST api。 ajax 调用将阻止重定向到 api 的 uri。
编辑:
请参阅以下有关从 java 进行 http 调用的示例
Primefaces 命令链接 https://www.primefaces.org/showcase/ui/button/commandLink.xhtml
使用这样的功能,您可以从 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;
}