Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Build AEM form component to store data in database

rsl_lucky
Level 4
Level 4

Hi All,

Have a requirement to build a Form with input params in Component html. End-user fills Form details and submitted data to be stored in external database Ex:MySQL. Data Source configuration of DB details in AEM have been taken care. Can you provide your insights on below on how to fulfill this. 

* How to pass Form input params from html to backend logic?

* Best way for back-end logic implementation ?

Any insights would help. Thanks in Advance.

 

1 Accepted Solution
manikanthar1295
Correct answer by
Level 5
Level 5

Hi @rsl_lucky 

 

You can use request.getparam("paramName"); in your servlet get method using httpSlingRequest object.

 

I think this might help you.

 

Regards

Manikantha R

View solution in original post

3 Replies
sanketd27011989
Level 2
Level 2

You can design form via <form> in html . You can call servlet via Ajax once submit button clicked. Prepare Java code for database connection and related logic.

rsl_lucky
Level 4
Level 4

In this approach, how can we pass Form input fields to backend logic for processing.

Any sample code across it would help.

manikanthar1295
Correct answer by
Level 5
Level 5

Hi @rsl_lucky 

 

You can use request.getparam("paramName"); in your servlet get method using httpSlingRequest object.

 

I think this might help you.

 

Regards

Manikantha R