We are using Struts2 Application wherein I want to send the recorded audio blob file which is in JavaScript, to Java Server (Action Class). I am using the following Ajax code to send the blob file.
Javascript:
var xhr=new XMLHttpRequest();
xhr.οnlοad=function(e) {
if(this.readyState === 4) {
console.log("Server returned: ",e.target.responseText);
}
};
var fd=new FormData();
fd.append("filename.wav",blob);
xhr.open("POST","getAudio",true);
xhr.send(fd);
My method in action class is getAudio(). So, since it is a data file, how can i receive it in my method and suggest the appropriate xml configuration to receive the same. It would be great, if any ideas. Thanks in advance.
解决方案
In Struts2 you can create xml config