AEM 6.4 form to store and read from jcr

telpom

21-08-2018

Hi, I'm a new user of AEM.

As an exercise I want to simulate an e-commerce in which I can write and read from jcr ...

In an "insert" page I am using a form container component (start / end) where there are some form text components:

id

brand

model

type

image

and at the end there is send button to refer (after completing all the fields) to the "display" page.

In the "display" page i want to show added products.

I followed these articles

create an AEM project 6.4 Maven archtype 13

https://helpx.adobe.com/experience-manager/using/maven_arch13.html

create a custom action

https://helpx.adobe.com/experience-manager/using/form_component_customaction.html

I have watched default option "store action" how to work, but my problem is how to work its java class to store data. I don't understand it.

I want to store my products in a specific folder, not in a "usergenerated" folder like do "store action".

Alternatively, someone suggest a java script code works effectively to add to jsp file of my custom action.

Thaks to the support

Sorry for my bad english

View Entire Topic

DarrenBiz

21-08-2018

If you are using AEM Forms 6.4, my recommendation would be to learn the Forms Data Integration [1] and integrate with a data model via JDBC using a mySQL database [2]. That is fairly easy to set up and is a common pattern you would use with a real instance. Its also very common to offload form data via REST or SOAP but that is usually harder to setup for test purposes. You (should) never use JCR to store data in a real setup for many reasons. The JCR is great but its not recommended to use as a data storage method (mostly due to replication issues).

If you still want to use JCR to persist your form data, there are quite a few tutorials on how to read/write from the JCR in AEM [3] [4]

[1] Adobe Experience Manager Help | AEM Forms Data Integration

[2] Adobe Experience Manager Help | Storing Adaptive Form Data 

[3] Adobe Experience Manager Help | Programmatically Accessing Adobe Experience Manager Content using th...

[4] Scott's Digital Community: Persisting CQ data in the Java Content Repository