Reputation: 2507
I am reading the guides, and in the first example, home.jsp
is defined as:
<%@page session="false"%>
<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
<sling:defineObjects/>
<%@ page import="javax.jcr.Repository,
javax.jcr.Session,
javax.jcr.SimpleCredentials,
javax.jcr.Node,
java.net.URLEncoder,
java.util.List,
java.util.Iterator,
javax.jcr.Value,
javax.jcr.RepositoryException"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><%= currentNode.getProperty("title").getString() %></title>
</head>
<body>
<div>
<h1><%= currentNode.getProperty("title").getString() %></h1>
<br>
<%= currentNode.getProperty("body").getString() %>
</div>
</body>
</html>
I thought <sling:defineObjects>
injects the currentNode
, but according to the tag docs, it is not.
So what is injecting it then?
Upvotes: 2
Views: 2138
Reputation: 413
Your initial thought was correct, <sling:defineObjects>
does in fact set that value. The tag docs you link to describe the attributes of the tag itself (i.e. the values you can pass INTO the tag), not the values that it sets.
If you look at the code for the DefineObjectsTag here, you can see that currentNode
is one of the things that gets added to the page context.
Upvotes: 4