0

在模板中,我想插入链接以使用文档和媒体字段下载文档,我这样做:

#set ($gid = $getterUtil.getLong($doc.getData().split("/").get(2)))
#set ($fid = $getterUtil.getLong($doc.getData().split("/").get(3)))
#set ($fileTitle = $doc.getData().split("/").get(4))
#set ($dlService = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService"))
#set ($fileEntry = $dlService.getFileEntry($gid, $fid, $fileTitle))

#set($fileTitle = $httpUtil.encodeURL($htmlUtil.unescape($fileEntry.getTitle())))
##Title and download link

<a href='/documents/$gid/$fid/$fileTitle'>$fileEntry.getTitle() </a><br />

该代码正在运行,但如果我在标题中插入一个带有空格的文件,它会崩溃。谁能帮我?

4

1 回答 1

1

我这样做

$httpUtil.decodeURL($htmlUtil.unescape($doc.getData()))

Tnx萨布丽娜

于 2012-06-01T16:33:04.720 回答