【发布时间】:2022-01-02 18:12:39
【问题描述】:
我正在阅读 portlet 中的 excel 数据并将其放在 Web Content 下,并将它们分类到不同的文件夹和子文件夹中。
我发现的只是在 Documents and Media 库下创建文件和文件夹,而不是在 Web Content 下创建文件和文件夹
https://help.liferay.com/hc/en-us/articles/360029045451-Creating-Files-Folders-and-Shortcuts https://help.liferay.com/hc/en-us/articles/360028725672-Creating-Folders
按照以下步骤使用DLAppService 方法addFolder 创建文件夹:
获取对DLAppService的引用:
@Reference
private DLAppService _dlAppService;
获取填充addFolder 方法参数所需的数据。由于通常会使用最终用户提交的数据创建文件夹,因此您可以从请求中提取数据。此示例通过javax.portlet.ActionRequest 和ParamUtil 执行此操作:
long repositoryId = ParamUtil.getLong(actionRequest, "repositoryId");
long parentFolderId = ParamUtil.getLong(actionRequest, "parentFolderId");
String name = ParamUtil.getString(actionRequest, "name");
String description = ParamUtil.getString(actionRequest, "description");
ServiceContext serviceContext = ServiceContextFactory.getInstance(
DLFolder.class.getName(), actionRequest);
使用上一步中的数据调用服务引用的 addFolder 方法:
Folder folder = _dlAppService.addFolder(
repositoryId, parentFolderId, name, description,
serviceContext);
请让我知道或指导我如何解决这个问题。
提前致谢。
【问题讨论】:
-
您想存储excel文件还是读取excel文件并使用数据创建网页内容?
-
@DanieleBaggio, 读取excel文件并使用数据创建网页内容