Page not rendering servlet POST request
Adobe Experience Manager, Version 2023.8.13099.20230810T160553Z | (I followed this method to check the version)
Hi there! I've been running in circles for weeks with this problem and I don't know what to try anymore, so I'm hoping to get some answers here. PS: I'm very new to this
What I want to accomplish: create a servlet that lets me update my model/component via an external payload (postman). I have a model with the fields "name" and "age" and they should start empty, and should update with the name and age I send via postman. Lastly, I want to create a scheduler that updates it every 30 seconds, clearing the content that was sent via servlet, but I'm not there yet, first I need to make the content actually display on the page with the servlet. This is all for learning purposes.
First, see how my AEM page is displaying right now: https://i.imgur.com/GwzC6dY.png
It's showing a null value for both fields. If I double click and manually change the name and age, it shows something like this:
"Name: john
Age: 20
John
20
"
However, if I update the name + age via postman, it doesn't update on the page.
Here are my codes:
ModelTeste.java code (model): https://pastecode.io/s/rrewbjj1
TesteServlet.java (servlet): https://pastecode.io/s/b2cfg9kp
.content.xml (component. It's under _cq_dialog folder): https://pastecode.io/s/qq6rjab2
modelteste.html (htl file): https://pastecode.io/s/d7o8iix9
And I didn't attempt to create the scheduler yet, since the first part is not working yet.
This is how postman looks like when I send the post request: https://i.imgur.com/DJgw2Cd.png
PS: I already tried with "form-data", "x-www-form-urlencoded", and even with the "Params" section, trying to send the request via the URL "http://localhost:4502/bin/TesteServlet?name=John&age=25".
Do you have any idea on how to proceed? Thank you so much in advance