我正在使用表单在Liferay中发送一些数据和附件。问题是我不能使用serveresource发送文件。我需要做一个ajax调用将数据发送到服务器。但是如何在liferay中这样做。我发布了我的代码
public class MainDriver extends MVCPortlet{
@Override
public void serveResource(ResourceRequest resourceRequest,
ResourceResponse resourceResponse) throws IOException,
PortletException {
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(resourceRequest);
String fullName = ParamUtil.getString(resourceRequest, "fullName");
String age = ParamUtil.getString(resourceRequest, "age");
File file = uploadPortletRequest.getFile("fileName");
System.out.println("The value of fullName "+fullName);
System.out.println("The value of age "+age);
System.out.println("The File "+file);
super.serveResource(resourceRequest, resourceResponse);
}
这是我的控制器类
for i in {1..10}; do
for j in {1..100}; do
(( dir = 100 * (i - 1) + j ))
echo cp -r *_$((dir)) Destination_folder${i}/
done
done
}
所以现在的问题是我得到了除文件以外的所有数据。
如何在liferay中将所有数据与控制器中的文件一起发送?