2012-05-31 2 views
0

, 난 이렇게, 문서 & 미디어 필드를 사용하여 문서를 다운로드하는 링크를 삽입 할 : 코드는 작동하지만이 파일을 삽입 할 경우 충돌을 Liferay 다운로드 파일 구조

#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 /> 

제목에 공백이있다. 아무도 도와 줄 수 있습니까?

+0

만 나는 공간에 파일 이름 전체 포틀릿 충돌로 파일을 삽입 할 때 .. – Sabrina

+0

어떻게? $ htmlUtil.escape가 다시 작동하지 않습니다. – Sabrina

+0

'$ fileTitle'이 비어 있기 때문에'#set ($ fileTitle = $ doc.getData(). split ("/"). get (4))'의 문제라고 생각합니다. – Sabrina

답변

1

내가 할 그

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

TNX 사브리나