0

I have created webpage in AEM having login functionality (username and password) and I need to pass these 2 paramaters using POST method. I am able to do the same using GET but when I try with POST, I get error stating that Content is modified/created.

I am passing the parameters using html <form action="destination.html" method="POST">

I read that I need to create a Sling Servlet which will manage my POST method. But the question is how to do so? and where to create that servlet file?

Thanks.

Jineet Vora
  • 329
  • 1
  • 2
  • 12

1 Answers1

0

You can use the same servlet and override the doPost method.

@SlingServlet(
methods = { "POST","GET" }, 
name="com.tti.tticommons.service.servlets.LeadTimeTrendsServlet",
paths = { "/services/processFormData" }
)
public class CommonServlet extends SlingAllMethodsServlet{   
...
@Override
protected void doPost(SlingHttpServletRequest request,SlingHttpServletResponse response) throws ServletException,IOException {
....
}

I have listed an example here AEM 6.1 Sightly basic form submit and redirect to same page

Community
  • 1
  • 1
Suren Konathala
  • 3,497
  • 5
  • 43
  • 73