gpt4 book ai didi

javascript - 将 VXML 应用程序根文档变量传递/公开给 JSP

转载 作者:行者123 更新时间:2023-12-02 23:09:53 24 4
gpt4 key购买 nike

我需要在我的 VXML 应用程序根文档中定义的变量(其他文档会修改这些变量)可供 JSP/EL 页面使用。这里的想法是,根据这些变量的值,我可以向 JSP 添加逻辑,以将不同的 VXML block 呈现回 IVR 浏览器。

到目前为止我所尝试的并没有产生任何错误。它根本不会在 EL 中呈现预期的 VXML 代码块。我的猜测是我没有在 EL 中正确取消引用它们。

以下是我尝试过的一些方法。

root.vxml 文档有

..
<var name="promptRetries" expr="''" />
...

开始.jsp:

<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml" application="/root.vxml" >

...

<assign name="application.promptRetries" expr="'3'" />

......

<block>         
<submit next="${pageContext.request.contextPath}/nextdoc.jsp" />
</block>

nextdoc.jsp

<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml" application="/root.xml" >

...

<!-- at this point I can print and see the value of 3 for promptRetries -->
<!-- How can I expose this to JSP to accomplish something like the code below

I have used .equals() and other forms in the EL expression with no luck.

-->
<c:if test="${(application.promptRetries eq 1)} ">
<!-- Setting prompts for 1 retry -->
<catch event="noinput undefined" count="1" >
<audio expr="curPrompt2"/>
<log expr="buildLogStr(ibmCallId, documentName,frmName ,blkName,
'event=noinput count=1 reprompt', '')" />
</catch>
</c:if>

.......

最佳答案

在 JSP 中开发 VoiceXML 应用程序时,您需要注意有两个执行空间。首先,生成 VoiceXML 的 Java 服务器。其次,执行它的 VoiceXML 浏览器。

您已经有一个使用 ${variable_name} 语法将数据从 JSP 传递到 VoiceXML 的示例。要将数据从 VoiceXML 传递到 JSP,您需要显式列出要在提交元素中发送的变量:

<submit next="${pageContext.request.contextPath}/nextdoc.jsp" namelist="promptRetries"/>

然后在第二个 JSP 页面中,使用

request.getParameter("promptRetries") 

访问从浏览器发送的变量。

关于javascript - 将 VXML 应用程序根文档变量传递/公开给 JSP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57419623/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com