Complex objects submitted by struts2 using jqueryajax in the background
Source: Internet
Author: User
The most important thing is that Struts2 is configured as follows to accept complex objects sent from the foreground through ajax & lt; packagename & quot; abstract_struts & quot; abstract & quot; true & quot; extends & quot; struts-default, json-default & quot; namesp the most important thing is that Struts2 is configured as follows to accept complex objects sent from the front end through ajax.
Function getFile (){
// FileInfo is a complex object corresponding to action. It can also be called a class object.
Var params = {fileInfo :{
FileName: $ ("# fileName"). val (),
FileType: $ ("# fileType"). val (),
FileContent: $ ("# fileContent"). val ()
}};
Return params;
}
============================ Background action ============ ========================================================== =
Public String addFile (){
System. out. println (fileInfo. getFileName (); // fileInfo must have the get and set methods.
System. out. println (fileInfo. getFileContent ());
Return SUCCESS;
}
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.