How to open an attachment using a link in an xpage

2019-03-04 22:26发布

How to open an attachment in an xpage using a link url? What are all the fields iln the url? Pls explain. Also about the document folder created in the 'xsppers' folder.

1条回答
贪生不怕死
2楼-- · 2019-03-04 23:18

The short answer how to open a attached Image is:

http://pathToyourDatabase/DatabaseName.nsf/0/DocumentUniversalID/$File/MyImage.jpg

you can create this link with:

var imageurl = facesContext.getExternalContext().getRequest().getContextPath() + "/0/" +  
                /*in my case: viewEntry.getDocument().getUniversalID()*/ 
                + "/$File/"+ AttachmentName;

placing this link in the src attribute of an <img> or in the url attribute of the <xp:image> tag will dislay this image on your xPage. This example works fine for me but for other Attachments you maby have to add ?OpenElement after the AttachmentName.

Update: I did a short experiment on this with a pdf file and it worked without the ?OpenElement just use the code to generate the url it should work. Additional you can look @ Link.

查看更多
登录 后发表回答