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:
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.