作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要在我的 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/
我是一名优秀的程序员,十分优秀!