@TarunKumar Check if any of the below two methods works.
context.currentResource("/content/...").adaptTo(FragmentTemplate.class);
context.request().adaptTo(FragmentTemplate.class);
If the servlet is called from author, then will have current logged-in user permissions.If it called from publish(live site), then will only have read access to /content
@Preethi1234 I see there is no need of creating dialog field on fly. Instead have the textfield hidden by default and show/hide based on you dropdown change listener.
@Keerthi0555
If you want to iterate through all the resources then go with iterator.
If you want a specific resource(s) with specific property then search using query builder.
Depends on your use case.