Highlighted

Create component to filter data from backend

ealmeida1

31-10-2019

Hey guys.

I'm new in adobe AEM. I'm trying to use the 6.5 version and figuring out how it works. So, I need to create a component to show a list of files and filter that files based on a drop down value. I'm looking for an example, but I didn't found some way to send values to filter a list in my back end. For now, I'm getting all the values from my @Model class, but I don't know how to send a parameter to filter that list. Is it possible? How is the best way to do that?

Thanks!

Eder

Replies

Highlighted

Ankur_Khare

MVP

01-11-2019

I would suggest to create a servlet which will get called whenever u will change the dropdown value and pass the selected dropdown value when u call ur servlet and process ur result in ur java class and send back the result to ui for display.

Highlighted

ealmeida1

05-11-2019

Hi ka786,

Thanks for answer. I'm trying to follow this example https://aem.adobemarketingclub.com/implementing-use-interface-using-sightly-in-aem-6-x/ . But doesn't work, I'm receiving an error:

"org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Compilation errors in org/apache/sling/scripting/sightly/apps/test/components/structure/assets/assets_html.java:

Line 38, column 1733 : com.test.MyComponent cannot be resolved to a type". Do you have a better tutorial?

Thanks!

Highlighted

ealmeida1

05-11-2019

Good!! I will try that.

One more question: Why I can't create a two way communication between @Model class and the htl page? Because I have some attributes in my model class and I need to access them. Is it correct put all that attributes in a servlet class?

Thanks for everything!