[MarkLogic Dev General] Image stored in marklogic server - display
it from JSP
Jason Hunter
jhunter at marklogic.com
Fri May 18 11:26:33 PDT 2007
> *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))
You wrote a library module (see your module declaration) but are calling
it like a main module. If you go to get-img-jpeg.xqy directly (always a
good step when debugging dynamic images) you'll probably see an error to
that effect. Remove the module line to make your code a main module.
Then you'll probably have success. If not, try going to the image
directly and see what other error you might be seeing.
> 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?
JSPs are not designed to return binary streams. They're for character
output.
-jh-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4506 bytes
Desc: S/MIME Cryptographic Signature
Url : http://xqzone.marklogic.com/pipermail/general/attachments/20070518/3dfb5fb5/smime.bin
More information about the General
mailing list