[XQZone General] JSP Tag library question
Nizamuddin, Rashid
rnizamuddin at edmunds.com
Thu May 12 12:23:51 PDT 2005
I placed MLXQueryTaglib.jar file under the lib folder and copied the
marklogicxquery.tld file in my WEB-INF and defined the entry in my
web.xml file still no luck
<taglib>
<taglib-uri>http://marklogic.com/jsp/taglib</taglib-uri>
<taglib-location>/WEB-INF/marklogicxquery.tld</taglib-location>
</taglib>
It gives me the following error.
javax.servlet.ServletException: com/marklogic/xqrunner/XQException
here is my jsp code, the XdbcServer is running on port 9061. Cant figure
out what's wrong.
<%@ taglib uri="http://marklogic.com/jsp/taglib" prefix="xq" %>
<xq:setDataSource host="localhost" port="9061"
user="edmunds" password="rdf"/>
<html>
<head>
<title>xq:query example 1</title>
</head>
<body>
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>
</html>
BTW, I am using Tomcat
Thanks
Rashid
-----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 6:22 PM
To: General XQZone Discussion
Subject: Re: [XQZone General] JSP Tag library question
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
_______________________________________________
General mailing list
General at xqzone.marklogic.com
http://xqzone.com/mailman/listinfo/general
More information about the General
mailing list