Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Create component to filter data from backend

ealmeida1
Level 1
Level 1

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

4 Replies
Ankur_Khare
Community Advisor
Community Advisor

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.

ealmeida1
Level 1
Level 1

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!

ealmeida1
Level 1
Level 1

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!