JavaEE - code example of ajax

Disclaimer: The materials used in this column are written by VIP students of Kaige Academy. Students have the right to remain anonymous and have the right to final interpretation of the article. Kaige Academy aims to promote VIP students to learn from each other based on public notes.

Doget access:

The code of the servlet is as follows

image

The Jsp page or html page code is as follows:

image

After the browser sends it, the content is as follows:

image

image

image

image

Note: In the past, there was an optimization function in the browser that it will cache the links you have visited. When you visit again, the browser will not request it again. It will directly read the local cache and cause your SMS to not be sent. The solution is to write a time parameter after this link

image

Dopost submission

The servlet code is still the same as before, just change the doget method to dopost jsp code as follows, the effect of running in the browser is the same as the above picture

image

File Upload:

image

image

Multiple file upload:

image

image

If you want to do a good job, hide the progress bar and wait for it to be displayed when he uploads the file. Determine whether the MD5 of the file exists in the java code!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326441524&siteId=291194637
Recommended