On Mon, Nov 23, 2009 at 12:20, Ben Short <[email protected]> wrote:
> Is there any way to access the jcr api in a jsp file in a cleaner way or via
> jstl?

Not directly, but with a small helper such as the ValueMap [1] and its
JCR implementation [2] in Apache Sling.

You use it as follows:
ValueMap map = new JcrPropertyMap(node);
String foo = map.get("foobar", "default"); // using default values and
automatic types, in this case expecting a string property
Integer counter = map.get("counter", Integer.class); // converts to
int (jcr api) or returns null if not present

[1] 
http://svn.apache.org/repos/asf/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ValueMap.java
[2] 
http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrPropertyMap.java

Regards,
Alex

-- 
Alexander Klimetschek
[email protected]

Reply via email to