spring mvc [@ResourceMapping] [1]獲取liferay spring MVC portlet中null的對象列表????spring mvc [@ResourceMapping] [1]在liferay spring MVC portlet中獲取null對象列表?
有什麼問題?
var jsonObjCommand =[{
dc: $("#dcCode").val() ,
question_Score : $("#101p").val() ,
question_Desc: $("#101d").val(),
"clinicAnalyzeQuestions.id" : 102,
"clinicAnalyzeQuestions.questions" : 'test',
"mobile" : $('#mobile').val(),
"state" : $('#state').val()
},{
dc: $("#dcCode").val() ,
question_Score : $("#102p").val() ,
question_Desc: $("#103d").val(),
"clinicAnalyzeQuestions.id" :102,
"clinicAnalyzeQuestions.questions" : 'test2',
"mobile" : $('#mobile').val(),
"state" : $('#state').val()
}];
$.ajax({
url : "${insert}",
type : 'POST',
datatype : 'json',
data : JSON.stringify(jsonObjCommand) ,
success : function(data) {
var content = JSON.parse(data);
$.each(content, function(i, state) {
$("#container2").hide();
$("#container").hide();
$("#frm1").hide();
$('#success').show();
$('#userCount4').text(state.success);
});
}
});
//控制器
@ModelAttribute(value = "jsonObjCommand")
public List<ClinicAnalyzeAnswers> obtenerJsonObjCommand() {
List<ClinicAnalyzeAnswers> jsonObjCommand = new ArrayList<ClinicAnalyzeAnswers>();
System.out.println(jsonObjCommand.size());
return jsonObjCommand;
}
@ModelAttribute("jsonObj1")
public ClinicPerson clinicPerson() {
ClinicPerson person = new ClinicPerson();
return person;
}
// @Transactional
@ResourceMapping("insert")
public void ajaxTestMethod(
ResourceRequest request,
ResourceResponse response,
@ModelAttribute(value = "jsonObjCommand") List<ClinicAnalyzeAnswers> jsonObjCommand,
@ModelAttribute(value = "jsonObj1") ClinicPerson person)
throws IOException, ParseException {
for (ClinicAnalyzeAnswers clinicAnalyzeAnswers : jsonObjCommand) {
System.out.println(clinicAnalyzeAnswers.getDc()+"aaa");
}
}
彈簧MVC [@ResourceMapping] [1]得到的對象中的liferay彈簧MVC的portlet空的列表????
在控制器空[]數組 幫我.....
什麼/是/問題?你能否詳細解釋你的問題? – Stuart
控制器中的數據爲空 –