Hi Ralph,
This can probably not be easily done with a JSP script. But you can
implement a servlet to handle the POST request for the content type. In
addition the servlet class would implement the
o.a.s.api.servlet.OptingServlet interface returning true only in case
the request is a POST for sending the notification. For other POST
requests, the accepts method would return false, in which case the
servlet resolver would then fall back to the default SlingPostServlet.
You can implement the servlet either in a bundle. Alternatively you may
also store the servlet source in the repository, e.g. at
/apps/my/resource/type/POST.java to handle POST requests for the
my/resource/type resource type. In this case you also have to deploy the
new Java script engine (located in the scripting/java module).
Regards
Felix
Ralph Bänziger schrieb:
Hi,
I'm currently writing a SLING application with a feedback component, which
allows a user to send a mail-message to a destination configured in the
component content. The component can be placed in multiple webpages.
The component renders a HTML-Form in a popup and POSTs it back to do the
post-processing (e.g. validation, sending email, display 'sent'-confirmation).
I want to use a HTTP POST to send back the feedback-form because the HTTP GET
is restricted in terms of length and displays the content in the browser URL.
The problem I'm facing is that SLING-script-selectors don't work for POST-actions, i.e. I only have the option to put POST.jsp in the script-folder of the component, but I don't have the option to put a feedback.POST.jsp in the script-folder to handle the POST related to the feedback-form-POST.
When I put the POST.jsp in the component-script-folder, it's no longer possible
to update the content of the feedback component with the default
SLING-POST-handler.
What's the recommended way to implement the feedback form?
Regards,