论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Tech Box
Dipslay image with dynamic data list using java and jsp
2013年5月2日 上午6:22
答复

Tech Box

等级: New Member

帖子: 18

加入日期: 2013年2月5日

最近的帖子

I used WCM dynamic data list to capture both textual and image information (via Image upload control). Now it needs to develop a java program with JSP to implement the customized portlet to display back such image content. The design is typical one by outputing the image control into HTML IMG element with 'src' attribute. But my question is that how can I know where the file path of image captured within dynamic data list. Or does it any existing Liferay API service to serve for this scenario.

Please advise.
Vilmos Papp
RE: Dipslay image with dynamic data list using java and jsp
2013年5月2日 上午6:42
答复

Vilmos Papp

LIFERAY STAFF

等级: Expert

帖子: 473

加入日期: 2010年10月21日

最近的帖子

My first idea is check how the file is linked to the list. If it's UUID, or DLFileEntryId, etc. there should be an API to retreive it. If you check the Documents and Media portlet you will see how the URL is generated for a document/image so you can build your URL based on that pattern. I'm not sure whether there is an API to build that URL out of the box, but there's a chance but should search for it in the portal source.
Tech Box
RE: Dipslay image with dynamic data list using java and jsp
2013年5月2日 下午5:41
答复

Tech Box

等级: New Member

帖子: 18

加入日期: 2013年2月5日

最近的帖子

Thanks of your comment. Since the image file was uploaded into dynamic data list (DDL), hence, the library of Document and Media portlet, such as DLFileEntry is not applicable. Also I try to search DDL related Java API, such as DDLRecordLocalServiceUtil, DDLRecordSetLocalServiceUtil, but all of them don't have API to convert as stream object.

Also I tried to list to ".toString" the content of DDLRecord and for the fields of capturing image, I convert the content as JSON object and found the file path

[{"name":"rss.png","path":"ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/11061/1.1/attachment","classPK":"11061","className":"com.liferay.portlet.dynamicdatalists.model.DDLRecord"}] - (file-upload).

But I still have no idea to transform the path into HTML IMG SRC attribute.
Vilmos Papp
RE: Dipslay image with dynamic data list using java and jsp
2013年5月3日 上午12:08
答复

Vilmos Papp

LIFERAY STAFF

等级: Expert

帖子: 473

加入日期: 2010年10月21日

最近的帖子

Hi,

I see your problem now, but I have to check it how the data is stored and can be accessed. I'm lack of free time currently, but if you can upload a sample war with minimal logic (just upload the file should be enough) I would try to check it when I have some free time.
Tech Box
RE: Dipslay image with dynamic data list using java and jsp
2013年5月3日 上午9:16
答复

Tech Box

等级: New Member

帖子: 18

加入日期: 2013年2月5日

最近的帖子

Hi,

I found out that below JSON object with attribute "path" in which the value "ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/1106/1.1/attachment" can transform as "http://localhost:8080/documents/ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/1106/attachment" is the URL link of the image "rss.png" that can be viewed with internet browser.

[{"name":"rss.png","path":"ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/1106/1.1/attachment","classPK":"11061","className":"com.liferay.portlet.dynamicdatalists.model.DDLRecord"}] - (file-upload).

But still not sure why such full URL link is wiped out the portion "1.1" from the original path as mentioned above.
Vilmos Papp
RE: Dipslay image with dynamic data list using java and jsp
2013年5月3日 下午1:09
答复

Vilmos Papp

LIFERAY STAFF

等级: Expert

帖子: 473

加入日期: 2010年10月21日

最近的帖子

Hi,

I think the 1.1 is the version of the attachment, but if you access it without specifying the version, than you can access the latest one (at least for documents and media it works like this)