0

I need to have variables that are defined in my VXML application root document, which other documents modify, available to the JSP/EL pages. The idea here is that based on the value of these variable I can add logic to the JSP to render different blocks of VXML back to the IVR browser.

What I have tried so far does not generate any errors. It simply does not render the expected block of VXML code within the EL. My guess is that I am not de-referencing them correctly in EL.

Below is some of what I have tried.

root.vxml doc has

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

start.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>

... ....

1 Answers1

1

When developing VoiceXML applications in JSP, you need to be aware that there are two execution spaces. First, the Java server that generates the VoiceXML. Second, the VoiceXML Browser that executes it.

You already have an example of passing data from JSP to VoiceXML with the ${variable_name} syntax. To pass data from VoiceXML to JSP, you need to explicitly list the variables to send in the submit element:

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

And then in your second JSP page, use

request.getParameter("promptRetries") 

to access the variable sent from the browser.

Jim Rush
  • 4,143
  • 3
  • 25
  • 27
  • Thanks, That helped me understanding the interaction between the JSP and VXML. I ended up by passing the parm on the submit tag (as you suggested) and using EL of the form . Agin thanks for your help. – CarlosV Aug 26 '19 at 15:25