Retrieving data from text file using jsp page -


how read data text file using jsp , retrieval should take place without using java code in jsp , text file should not placed under web-inf?

html5 introduced javascript object filereader. supported major browsers , no additional libraries needed. after instantiate new object, can read file in arraybuffer, binarystring, dataurl, or text. here example:

document.getelementbyid('file').addeventlistener('change', function(e) {        var file = document.getelementbyid('file').files[0];        var reader = new filereader();      reader.readastext(file);      reader.onload = function(e) {          document.getelementbyid('results').innertext = reader.result;      }  });
<input id="file" type="file">  <div id="results"></div>

i put working example on jsfiddle

here link documentation.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -