Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to send the values from end user dialog to servlet?

Avatar

Former Community Member

Hi

How i can send the value to servlet or java class from dialog (not editorial dialog) its just like end user dialog getting information from user and process it in JCR.

When end user clicks the link the dialog needs to opened and collects the details from user and process in JCR via Java Class ?

How it can be achieved ?

"For end user perceptive developer needs to show some dialog and data table etc. In this case which one is recommended in CQ to build the end user elements whether JQUERY or EXT JS??"

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 10

A end user typically fills in data into a CQ web form and submits the data to CQ servlet. Once you get that data at the servlet - you can process it the way you want. You can persist it into the JCR, etc. 

See this community article that teaches you how to get data from an end user using a Sling Servlet and a CQ web page:

http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

If you want to collect the data using a dialog (instead of a web page), then you can do so. What you do is collect the values from the dialog, and then perform the submit using an AJAX call to the Sling Servlet. 

Hope this helps

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

A end user typically fills in data into a CQ web form and submits the data to CQ servlet. Once you get that data at the servlet - you can process it the way you want. You can persist it into the JCR, etc. 

See this community article that teaches you how to get data from an end user using a Sling Servlet and a CQ web page:

http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

If you want to collect the data using a dialog (instead of a web page), then you can do so. What you do is collect the values from the dialog, and then perform the submit using an AJAX call to the Sling Servlet. 

Hope this helps

Avatar

Former Community Member

What u said is all exactly right.

It has option for selecting the action when i create a form via drag and drop from sidekick (form components) in this case my request will hit to JSP only not JAVA class.

So in jsp itself the persistence logic needs to perform not in java.

In second case when i create the form by coding in a jsp then i can hit my custom servlet java class as u mentioned in above link right ?

Which one is best way for creating the form ?

Thanks

Avatar

Former Community Member

I saw this but whether this way is recommended if yes means i which scenario it will suits.

By using this way i mentioned below

<form method="POST" action="/content/page/first" enctype="multipart/form-data"><input type="text" name="width" /><input type="hidden" name="width@TypeHint" value="Long" /><input type="checkbox" name="checked" /><input type="hidden" name="checked@TypeHint" value="Boolean" /><input type="text" name="hobbys"/><input type="text" name="hobbys"/><input type="text" name="hobbys"/><input type="hidden" name="hobbys@TypeHint" value="String[]" /><input type="Submit" /></form>

 

Thanks