我使用Liferay,我有代码:
@ResourceMapping(value = "keaFileUpload")
public ModelAndView fileUpload(ResourceRequest request, ResourceResponse response,
ModelMap modelMap) throws PortalException, SystemException {
// code
}
如何使用Multipart作为参数请求?例如MultipartHttpServletRequest? 当我使用它而不是ResourceRequest请求时,我有错误。
答案 0 :(得分:0)
当表单是multipart / form-data时,你应该从UploadPortletRequest而不是ResourceRequest获得额外的参数(比如“name”)。
获取参数的正确形式:
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(request);
String name = ParamUtil.getString(uploadRequest,"name");
您也可以查看此链接
https://www.liferay.com/community/forums/-/message_boards/message/17237791