Hi Gert,
Am Montag, den 14.04.2008, 16:22 +0200 schrieb Gert Vanthienen:
> L.S.,
>
> The subject basically covers the entire question: I would like to
> execute a JCR query from within an ESP page to get a set of nodes in the
> order I want (descending by date created). How can I do this?
I suggest you use the ResolverResolver.findResources(String query,
String language) method. This returns an Iterator<Resource> according to
the query. In ESP this would be something like:
<%
var iter = request.resourceResolver.findResources("..xpath..",
Packages.javax.jcr.query.Query.XPATH);
while (iter.hasNext()) {
var resource = iter.next();
.. do whatever you like ..
}
%>
If are more interested in the result rows than in the resources found,
you would call the ResourceResolver.queryResources(String query, String
language) method which returns you an Iteratory<Map<String, Object>>,
that is an iterator on the rows represented as maps indexed by column
names.
Hope this helps.
Regards
Felix