The JSP file handling the POST method for your component should be named POST.jsp
rather than mycomponent.POST.jsp
.
Please notice that if you intercept all POST requests to your component, you won't be able to edit it on the author instance using a dialog (as the dialog simply POSTs data to the component URL). To avoid it, consider using a custom selector (like form
). Your form should look be declared like this:
<form id="myForm" action="${resource.path}.form.html">
and the script handling POST request should be called form.POST.jsp
.
The second important thing is that you should use Java classes rather than JSP files to store business logic. In this case it means that the form.POST.jsp
script can be replaced with a Sling servlet declared as follows:
@SlingServlet(
resourceTypes="myproject/components/mytestcomponent",
methods="POST",
selectors="form")