We implemented dynamic dropdown in content fragment using the reference of https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/dynamic-dropdown-content-f...
Now, what if I want to pass the request parameter while calling the servlet. /bin/dropdownList?paramName=paramValue this is not working. Can anyone please help me with this.
Solved! Go to Solution.
Views
Replies
Total Likes
The post which you have referred is to provide a datasource in content fragment by using an already registered servlet. So, for e.g if you have a servlet registered with sling:resourceType as /bin/dropdownList then you can use that on the datasource node by setting sling:resourceType property as /bin/dropdownList but you cannot add parameters to it since it will interrupt your sling resolution.
If you want to get some data from your datasource to your servlet what you can try is setting some extra property on your datasource and set the value which you want to pass e.g dummyProperty and then you can probably retrieve that datasource node in your servlet to fetch it
For e.g
request.getResource().getChild("datasource").getValueMap().get("dummyProperty");
I haven't tried this though. But hope this helps.
Hi @VanitaNa
Please check https://aemlab.blogspot.com/2022/01/aemaacs-touch-ui-dialog-dynamic-dropdown.html
Views
Replies
Total Likes
Hi,
Can you be more explicit on "what is not working"? Did you implement the needed changes to handle the queryParam in the servlet accordingly? You must do something like this in the servlet:
@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) {
// Get the parameter you passed
String myValue = request.getParameter("paramName");
// Do whatever you need with that value
Hope this helps
Views
Replies
Total Likes
Hi @EstebanBustamante , thanks for the response.
The problem I am facing is, call is not going to servlet only that means the servlet is not triggering when I pass the queryParameter. If I don't pass any queryParameter then the servlet is triggering.
String myValue = request.getParameter("paramName");
I am using this, but firstly the servlet should trigger.
Views
Replies
Total Likes
Can you try this http://www.sgaemsolutions.com/2019/01/dynamically-populate-drop-down-values.html ? Are you adding a debugger or log statement to check if the servlet is not being called? Or are you assuming the servlet is not called because there are not results? There could be a chance the servlet is called but the implementation is not returning correctly the values.
Views
Replies
Total Likes
The post which you have referred is to provide a datasource in content fragment by using an already registered servlet. So, for e.g if you have a servlet registered with sling:resourceType as /bin/dropdownList then you can use that on the datasource node by setting sling:resourceType property as /bin/dropdownList but you cannot add parameters to it since it will interrupt your sling resolution.
If you want to get some data from your datasource to your servlet what you can try is setting some extra property on your datasource and set the value which you want to pass e.g dummyProperty and then you can probably retrieve that datasource node in your servlet to fetch it
For e.g
request.getResource().getChild("datasource").getValueMap().get("dummyProperty");
I haven't tried this though. But hope this helps.
Views
Likes
Replies