Ajax+Struts2 receives array form (with code)
Apr 25, 2018 pm 04:10 PMThis time I will bring you Ajax Struts2 to receive an array form (with code). What are the precautions for Ajax Struts2 to receive an array form? The following is a practical case, let's take a look.
I will explain below through two methods: ordinary form and ajax. First we have the following entity, an action and a jsp.
Student.java
1 2 3 4 5 6 7 8 9 10 |
|
xy.jsp
1 2 3 4 5 6 |
|
Let’s get started. The following code is written in xy. jsp script area.
Normal form form——Traverse the array, construct the form hidden field
1 2 3 4 5 |
|
Special case
1 2 3 |
|
When passing a single attribute, struts can recognize it and represent three different students. But passing two attributes won't work, because struts doesn't know the combination. Not recommended.
ajax form - traverse the array and construct a json object
1 2 3 4 5 6 7 8 |
|
In fact, we constructed such a json object
1 2 3 4 5 |
|
I believe you have mastered the method after reading the case in this article, and more How exciting, please pay attention to other related articles on php Chinese website!
Recommended reading:
Detailed explanation of JSONP implementation principles and cases
How to use the ajax.load() method in jQuery
The above is the detailed content of Ajax+Struts2 receives array form (with code). For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What to do if the blue screen code 0x0000001 occurs

The computer frequently blue screens and the code is different every time

What does the blue screen code 0x000000d1 represent?

GE universal remote codes program on any device

Detailed explanation of the causes and solutions of 0x0000007f blue screen code

How to use JavaScript to implement real-time verification of the input box content of a form?
