简体   繁体   中英

Read and write text files using Ajax, jQuery, Java

I have a requirement to read and write bulk of text files at server side.

How can we write using Ajax, Java... Have little bit idea about these technologies but I just need an idea to implement. After that I feel I can proceed. Could you please help me?

Firstly the text files are going to have to be publicly accessible. They cannot exist in a private context on the server, as JavaScript is a client side technology.

Once they are public, you can simply do an AJAX request on the file location, and then parse them as required.

If having them in a public location is going to be a problem, you will need to have a page that serves them to authenticated accounts only, so only people that are logged in can view them. This means they will have to be served via a server side script at some point, which the AJAX request can then fetch as required.

However if you take this approach, you might as well take out the AJAX and just have the server side script do the processing for you and feed out the result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM