Hi Qian,
Please see attached CollectDigits.jsp example which produces a vxml. The JSP allows the VXML to be dynamic in that request parameters can be passed and vxml is generated on the fly. This sample demonstrates prompt with collect digits and it's been validated on EDP.
In regards to <record> element, you can store the wav file to your preferred location by submitting the vxml form using POST method, multipart form data to your preferred endpoint (e.g Servlet, REST interface). You can find an example on this site:
http://www.w3.org/TR/voicexml20/#dml2.3.6
I'm attaching it here for your convenience. See submit tag.. this is where you will define endpoint which will be responsible for saving the file.
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml
http://www.w3.org/TR/voicexml20/vxml.xsd">
<form>
<property name="bargein" value="true"/>
<block>
<prompt>
Riley is not available to take your call.
</prompt>
</block>
<record name="msg" beep="true" maxtime="10s"
finalsilence="4000ms" dtmfterm="true" type="audio/x-wav">
<prompt timeout="5s">
Record a message after the beep.
</prompt>
<noinput>
I didn't hear anything, please try again.
</noinput>
</record>
<field name="confirm">
<grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/>
<prompt>
Your message is <audio expr="msg"/>.
</prompt>
<prompt>
To keep it, say yes. To discard it, say no.
</prompt>
<filled>
<if cond="confirm">
<submit next="save_message.pl" enctype="multipart/form-data"
method="post" namelist="msg"/>
</if>
<clear/>
</filled>
</field>
</form>
</vxml>