[MarkLogic Dev General] Image stored in marklogic server - display it from JSP

Saptarshi Newyork saptarshi.newyork at yahoo.com
Fri May 18 10:01:23 PDT 2007


Hi,
  My first question is regarding display an image from JSP when the image is stored in Marklogic server.
   
  I have tried 2 things in the JSP as listed below:
   
  1. (No Result - Red cross mark in place of the image. Server could not execute the xqy file)
   
  <image width="400" height="300" 
  src="get-img-jpeg.xqy?uri={fn:base-uri(doc("c:/100_2754.JPG")))"/>
   
  Here I have tried to call a XQY file with the input of the uri of the image. The XQY file has the code like the following:
   
  module "http://www.w3.org/2003/05/xpath-functions"
  let $uri := xdmp:get-request-field("uri")
  return (xdmp:set-response-content-type("image/jpeg"), doc($uri))
   
  It does not show me the image. I want to know 
        i)  How can I call an xqy file from a JSP?
        ii) Can I define XQY functions inside a JSP? What will be the syntax?
   
  2. (return nothing)
   
  <xq:execute >
     <xq:query>
         let $uri := fn:base-uri(doc("100_2754.JPG"))
         return (xdmp:set-response-content-type("image/jpeg"), doc($uri))
    </xq:query>
  </xq:execute>
   
   
  I don't want to store the images in the file system and want to store them in marklogic. Please tell what shall be the right way to solve this problem.
   
  Please also let me know if it is possible to define xquery function in the JSP and call XQY from JSp?
   
  Thanks in advance,
  Regards,
  Saptarshi

 
---------------------------------
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20070518/4d9572d4/attachment.html


More information about the General mailing list