Ajax pass-through list collection

Source: Internet
Author: User

1. In action

Class Action1 {

Private list<dept> deptlist; Give a Get method

Peivate String IDs,-------get Set

Public String functions () {

Deptlist=xiaoserviceimpl.getbyid (IDS)

Return "Ajax";

}


}


Configuration file:

<result name= "Ajax" type= "JSON" >
<param name= "Includeproperties" >
deptlist \ [\ d+ \]\.id,
deptlist\ [\ d+ \] \.name,
</param>
</result>

JSP page: Write in C:foreach to implement the dynamic transmission of IDs

function onload () {

URL: "Action1?ids=${deptids.ids}",

Type: "Post",

Success:function (data) {

for (var i = 0; i < data.deptList.length; i++)

{html + = "<option value= '" + data.deptlist[i].id+ "' >" + data.movetypelist[i].name + "     </option> "; }

Then splicing

$ ("#selectType"). Append ("<option value= '-1 ' > Please select </option>" +html);

},

}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.