Hi Sami
Not sure how to get hold on a content node inside the
contentNodeIterator-tag (I'm more the scriptlet-type *cough*).
anyway - a possible solution would be (using jstl foreach):
<jsp:scriptlet>
//set the collection of content to page context for iterating
over them
pageContext.setAttribute("test",Resource.getActivePage
(request).getContent("mainColumnParagraphs").getChildren());
</jsp:scriptlet>
<hr />
<c:forEach items="${test}" var="link" varStatus="status">
<a href="?id=${link.UUID}">${link.handle}</a><br />
</c:forEach>
<hr />
and for retrieving the node based on uuid use:
<jsp:scriptlet>
String uuid = request.getParameter("id");
if(uuid != null){
String sql = "SELECT * FROM nt:base where jcr:uuid
like '"+uuid+"'";
Query q = MgnlContext.getQueryManager
(ContentRepository.WEBSITE).createQuery(sql, "sql");
QueryResult result = q.execute();
Iterator it = result.getContent().iterator();
while(it.hasNext()){
Content c = (Content)it.next();
out.println(c.getTitle());
}
}
</jsp:scriptlet>
I hope that's of use to you. Be aware that this is just a quick
solution. There are maybe more efficient/elegant ways to solve your
task.
cheers, tm
On 01.08.2006, at 08:21, Sami Honkonen wrote:
On Mon, 2006-07-31 at 16:51 +0200, Thomas Martin wrote:
for content just use .getUUID(); on your content.
for nodedata: afaik the name has to be unique (otherwise content of
nodedata gets overwritten)- so below certain content all nodes will
have unique identifier just use .getName() on your nodedata.
I need to retrieve the id within a contentNodeIterator-tag in JSP. How
do I do that?
And how do I later retrieve content based on that id?
Sorry for the ambiguity in terms.
--
Sami Honkonen
Reaktor Innovations Oy
[EMAIL PROTECTED]
+358 40 535 3463
----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------