On Fri, 25 Feb 2011 00:05:42 +0100, Thiago H. de Paula Figueiredo
<[email protected]> wrote:

On Thu, 24 Feb 2011 19:54:37 -0300, Martin Strand <[email protected]> wrote:

Patching the Form component to prevent redirects on validation errors means we don't have to bother setting up clustered sessions only to display these error messages. :)

What did you do to make Form not redirect-after-post? As far as I know, this is completely separate from the component. I guess this can be implemented by adding a new ComponentEventResultProcessor.

Exactly, and once the new ComponentEventResultProcessor is in place you only need to patch Form#onAction() and make it return a special value when there are validation errors.


Hmm, now that I reexamine this solution it turns out that 5.2 introduced StreamPageContent return values. Seems like this change can now be done with a small addition at the end of Form#onAction(), no special ComponentEventResultProcessor required:

if (activeTracker.getHasErrors())
  return new StreamPageContent(resources.getPage().getClass());


It would be great if this was the default behaviour, mostly because it would make caching possible for pages with forms. I know nothing about portlets or what problems they would introduce, would it be possible to have Form#onAction() return new ValidationFailure(...) and then let a ValidationFailureResultProcessor figure out what to do?


public void processResultValue(ValidationFailure value)
  throws IOException
{
  if (portlet)
    doNothing();
  else
    renderCurrentPage():
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to