سؤال

Lets say we have a XPage with following code snippet which displays an image using javascript formula:

<xp:image id="image1"><xp:this.url><![CDATA[#{javascript:"actn005.gif"}]]></xp:this.url></xp:image> 

actn005.gif is present in the current database as image resource. When I click on the "Preview in Notes" and get the source it displays something like this for Image:

<img id="view:_id1:image1" src="/xsp/Naveen/Experiments.nsf/xsp/actn005.gif" alt="" class="xspImage">

When I click on the "Preview in Web Browser" and get the source it displays something like this for Image:

<img id="view:_id1:image1" src="/Naveen/Experiments.nsf/actn005.gif" alt="" class="xspImage"> 

You can see that in case of "Preview in Notes" it adds xsp before and after the path of the database. My question is WHY? The image displays in both cases with no issues. But if I have XPage which renders image lets call it - XPage_Rendering_Image.xsp. Because of which the XPage code

<xp:image id="image1"><xp:this.url><![CDATA[#{javascript:"XPage_Rendering_Image.xsp"}]]></xp:this.url></xp:image> 

renders as:

<img id="view:_id1:image1" src="/xsp/Naveen/Experiments.nsf/xsp/XPage_Rendering_Image.xsp" alt="" class="xspImage"> 

and then it FAILS! I posted this question earlier on XPages forum and was suggested using a normal image tag like

<img src="#{javascript:'XPage_Rendering_Image.xsp'}" alt="" class="xspImage" />.

But is there a way to make this work using <xp:image> tag? Is this a bug?

هل كانت مفيدة؟

المحلول

It might not work as you would like it (and many others), but it works as designed. If you want to provide your own image source (I presume the XPage_Rendering_Image.xsp is an XAgent) you have to use the Extension API and provide a resource renderer. Or you stick with the standard html img tag as suggested in the forum. The XSP path part in the Notes client is needed so the local web server can recognize that it is to be rendered by the XSP engine and not a classic client part.

Update: the /xsp/.... URL works on the web too. So that's what you need.

نصائح أخرى

I would like this to be considered as bug and fixed by IBM. I have also encountered this discrepancy and found no solution (conditional rendering based on client/browser is not an option).

For example, native link to "$Icon" image resource does not work either.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top