Felix Meschberger wrote:
> Hi Darrel,
>
> Darrell Pittman schrieb:
>> I am not sure if this is the place to post how-to questions but here goes:
>> Can someone tell me if it is possible to validate posted data (without
>> relying on NodeTypes) and re-render the edit/add form with the posted data
>> (and validation errors) upon validation failure.
>
> Considering you are using Sling and SlingPostServlet to update data, you
> are certainly at the right place ;-)
>
> Currently, the SlingPostServlet just updates the repository with your
> posted data without any validation.
>
> But you have a series of options to cope with this.
>
> You can have your specialized servlet checking the data and redirecting
> to the form again in case of validation faliure. In case of validation
> success you forward the request to the SlingPostServlet by overwriting
> the resource type and optionally use a different resource path to apply
> the data to, for example:
>
> if (validate(request)) {
> String actualResourcePath = ....;
> RequestDispatcher rd = request.getRequestDispatcher(
> actualResourcePath, "sling/servlet/default");
> rd.forward(request, response);
> } else {
> // draw the form with messages
> }
>
>
If you plan to use the forward (which is a good way of handling this),
you have to use latest Sling from svn trunk. The released version does
not implement the forward.
Carsten
--
Carsten Ziegeler
[EMAIL PROTECTED]