留言板

Dipslay image with dynamic data list using java and jsp

Tech Box,修改在10 年前。

Dipslay image with dynamic data list using java and jsp

New Member 帖子: 18 加入日期: 13-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.
thumbnail
Vilmos Papp,修改在10 年前。

RE: Dipslay image with dynamic data list using java and jsp

Liferay Master 帖子: 529 加入日期: 10-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,修改在10 年前。

RE: Dipslay image with dynamic data list using java and jsp

New Member 帖子: 18 加入日期: 13-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.
thumbnail
Vilmos Papp,修改在10 年前。

RE: Dipslay image with dynamic data list using java and jsp

Liferay Master 帖子: 529 加入日期: 10-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,修改在10 年前。

RE: Dipslay image with dynamic data list using java and jsp

New Member 帖子: 18 加入日期: 13-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.
thumbnail
Vilmos Papp,修改在10 年前。

RE: Dipslay image with dynamic data list using java and jsp

Liferay Master 帖子: 529 加入日期: 10-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)