How we can fetch any data of jcr content in java class and how we can pass any node value from jsp page to java class??
Solved! Go to Solution.
You can get input from users (in the JSP) and pass the data back to an AEM service. This is an basic use case when working in AEM. We have a lot of how to articles that show how to get data from a front end to a back end. See:
http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
http://helpx.adobe.com/experience-manager/using/persisting-cq-data-java-content1.html
Views
Replies
Total Likes
You don't. ;)
Fetching of content in java class is done using the Repository, as with any node. To pass the information to a class, you could use a custom tag and send the path of the node from where to fetch the data as a property. If you are in a scriptlet, then it is a normal method call and you can do whatever you want. But you should avoid using mix of scriptlets and calls to services and other java classes as much as possible. Use Beans and tags as much as possible and do not push logic into the JSP code. It only makes it hard to test.
The ACS project has a lot of nice things in it, like the Sling Model Injector, WCM Tags and Common Util that will help a lot. Take a look at how they are structuring things and go from there.
/Ove
You can get input from users (in the JSP) and pass the data back to an AEM service. This is an basic use case when working in AEM. We have a lot of how to articles that show how to get data from a front end to a back end. See:
http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
http://helpx.adobe.com/experience-manager/using/persisting-cq-data-java-content1.html
Views
Replies
Total Likes
I think we can pass any node value to JAVA class but the class is only Sling Servlet.
<form name="formName" action="/path/of/slingservlet?nodeValue="+nodeValue>
<input type="submit" value="Send"/>
</form>
Then in the servlet you can get it by request.getParameter("nodeValue") and you can use it. You can also make an ajax call. May I know the actual requirement?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies