Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (2)

Answers (2)

rajas66269496 11-10-2018

Generally, you can call servlet different ways

You can call it using AJAX request, which normally you use to load the content without refreshing entire page

$("button").click(function(){

    $.ajax({url: "/bin/servlet", success: function(result){

        $("#div1").html(result);

    }});

});

You can also use HTML form action to call servlet

<form action="/bin/servlet" method="get">

  First name: <input type="text" name="fname"><br>

  Last name: <input type="text" name="lname"><br>

  <input type="submit" value="Submit">

</form>

  • You can directly call the servlet by hitting the servlet URL in the browser
  • You can also call servlet in dialog to populate drop down list etc.

Adobe Experience Manager Help | Populating AEM Component Dialog fields using JSON data returned by S...

In AEM most of the time, we use AJAX approach and populating dialog fields which are step 1 and 4