Apache Struts 2 Plugin Registry > Home > Struts2 JCR Plugin |
Name |
JCR Plugin |
Publisher | Max Skripnikov (sibutu project) |
License | Open Source |
Version | 1.0 |
Compatibility | Struts 2.0 + |
Homepage | http://code.google.com/p/struts2-jcr-plugin/ |
Plugin for the struts2 to provide transparent JCR(JSR-170) integration. Plugin consists of two parts - annotation based interceptor for preloading JCR nodes, and wrapper classes for transparent wrapping of JCR Nodes so they implement both javax,jcr.Node and java.util.Map. This approach allows node's properties to be set directly by Struts2, also validation can easily be done and JCR node's properties can be referenced in JSP pages in a standard way.
* Easy access to jcr node's properties on jsp pages
* Preloading nodes using annotation
* Download the Plugin and put in into your WEB-INF/lib folder.
* Configure the interceptors stack to include JCR interceptor
* Add lines to spring config describing JcrTemplateWrapper
The following example demonstrates plugin usage advantages. There is struts action AddressAction which is used to edit address. Address is a JCR node, having property addressId which is unique for each address node and serves as identifier.
Because the node is wrapped, jsp code interacts with the node in a way like it is java.util.Map. Then the page is rendered, the node is automatically loaded from repository using path from the annotation and the addressId provided as a parameter. After a user fills in and submits the form the node loaded again and it's properties are set by struts. The only thing we need to do is to save the node.