Hi @dilli_babu_22 , Your question is a little confusing, but as far as I understand, below are the solutions.
If your data source structure is as below and you want to get the value of the tag path in the servlet class, then you can get it with the help of a resource.
<!-- # cq:dialog xml -->
<items jcr:primaryType="nt:unstructured">
<colorTags
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldDescription="Select the color tags"
fieldLabel="Color Tags"
multiple="{Boolean}true"
name="./colorTags">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="/bin/colorTagLists"
tagsPath="/content/cq:tags/learning/color"/>
</colorTags>
</items>
<!-- # cq:dialog xml -->
Getting tagsPath in servlet class :
resourceResolver = request.getResourceResolver();
pathResource = request.getResource();
resourceList = new ArrayList<>();
/* Getting AEM Tags Path given on datasource Node */
String tagsPath = Objects.requireNonNull(pathResource.getChild("datasource")).getValueMap().get("tagsPath", String.class);
assert tagsPath != null;
Please refer to this article for full details - https://unlocklearning.in/dynamic-dropdown-in-aem/
I hope this could help you!!!
Regards
Shiv