我有一个 Spring MVC 应用程序。Jsp页面包含表单,提交。我的控制器的方法如下所示:
@RequestMapping(value = "photos/fileUpload", method = RequestMethod.POST)
@ResponseBody
public String fileDetailsUpload(List<PhotoDTO> photoDTO,
BindingResult bindingResult,
HttpServletRequest request) {
// in the point **photoDTO** is null
}
我的课是:
public class PhotoDTO {
private Boolean mainPhoto;
private String title;
private String description;
private Long realtyId;
//getters/setters
但是,如果我编写相同的方法,但 param 只是我的对象:
@RequestMapping(value = "photos/fileUpload", method = RequestMethod.POST)
@ResponseBody
public String fileDetailsUpload(PhotoDTO photoDTO,
BindingResult bindingResult,
HttpServletRequest request) {
// Everething is Ok **photoDTO** has all fields, which were fielded on the JSP
在这种情况下我该怎么办?如果我在 Jsp 上有许多PhotoDTO对象(15),我如何才能在服务器部分接收所有这些对象?