[XQZone General] JSP Tag library question

Ron Hitchens ron.hitchens at marklogic.com
Fri May 6 18:21:49 PDT 2005


    That's progress.  It means the web container knows
which classes to use for the tags.

    The error you're seeing indicates the container can't
find the classes in the jar file.  Double check that
MLXQueryTaglib.jar is in WEB-INF/lib under your web
app and that it's readable.

    It may require re-deploying your web app, or even
restarting, depending on the container you're using.

    Use the .war file including in the JSP distribution
as a guide if you're still having trouble.

On May 6, 2005, at 5:38 PM, Nizamuddin, Rashid wrote:

> Thanks for ur prompt response.
> I did enter the .tld file definition in the web.xml file.
>
> I get this message when I run the file
> org.apache.jasper.JasperException: executing query:
> com.marklogic.xqrunner.XQException: Not Found
>
> Thanks
>
>
> -----Original Message-----
> From: general-bounces at xqzone.marklogic.com
> [mailto:general-bounces at xqzone.marklogic.com] On Behalf Of Ron Hitchens
> Sent: Friday, May 06, 2005 5:35 PM
> To: General XQZone Discussion
> Subject: Re: [XQZone General] JSP Tag library question
>
>
>     You've missed one important step.  You need to add
> a taglib element to the web.xml descriptor for your
> web app.
>
>     The file marklogicxquery.tld contains the tag
> library definitions -- tag names, allowed attributes and
> the classes that implement them.  The MLXQueryTaglib.jar
> file contains the actual compiled Java classes.
>
>     The linkage between a tag prefix and a tag definition
> library is established by this line at the top of your JSP:
>
>   <%@ taglib uri="http://marklogic.com/jsp/taglib" prefix="xq" %>
>
>     But this doesn't name a .tld file, it refers to it
> indirectly by a URI.  The association of a URI to a TLD
> is done in the web.xml file:
>
> <taglib>
>      <taglib-uri>http://marklogic.com/jsp/taglib</taglib-uri>
>
> <taglib-location>/WEB-INF/taglib/marklogicxquery.tld</taglib-location>
> </taglib>
>
>     This lets the web container know that the URI in
> a JSP refers to a given TLD, which then identifies
> the classes to use.  Without this, the container does
> not know how to execute the tags.
>
>     If you look at the web.xml file in the JSP source
> tree, you'll see the definitions.  Not that in the
> example about, the TLD is in a subdir below WEB-INF.
> Adjust the path as needed to match wherever you place
> the TLD relative to your web app.
>
> On May 6, 2005, at 4:44 PM, Nizamuddin, Rashid wrote:
>
>> Hi,
>>
>> I have a question regardingusing the tag library in a jsp file.
>>
>> I downloaded ur jsp tag library distributeion and copied
>> marklogicxquery.tld in my WEB-INF folder and the jar file
>> MLXQueryTaglib.jar under the lib folder .
>>
>> I tried ur first example in the tutorial but it didn't work
>> May I know what is wrong
>> The following is the code I pasted in the jsp
>> <%@ taglib uri="http://marklogic.com/jsp/taglib" prefix="xq" %>
>>
>>
>> <html><head><title>xq:query example 1</title></head>
>> <body>
>>     <xq:setDataSource host="localhost" port="8061"
>>        user="edmunds" password="rdf"/>
>>
>>     My favorite fruits:
>>     <ul>
>>     <xq:execute>
>>         <xq:query>
>>             for $i in ("apple", "pear", "orange", "guava")
>>               return <li>{ $i }</li>
>>         </xq:query>
>>     </xq:execute>
>>     </ul>
>>     </body>
>>
>> </body>
>> </html>
>> _______________________________________________
>> General mailing list
>> General at xqzone.marklogic.com
>> http://xqzone.com/mailman/listinfo/general
>>
> ---
> Ron Hitchens {ron.hitchens at marklogic.com}  650-655-2351
>
> _______________________________________________
> General mailing list
> General at xqzone.marklogic.com
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General at xqzone.marklogic.com
> http://xqzone.com/mailman/listinfo/general
>
---
Ron Hitchens {ron.hitchens at marklogic.com}  650-655-2351




More information about the General mailing list