On Tuesday 12 December 2006 13:36, Andreas Andreou wrote:

> >> I have noticed that the PageValidationListener for the old page is
> >> always called when submitting a form, even when the form submission
> >> listener redirects to a different page. Sometimes this failed in my
> >> project.
>
> Why exactly does it fail?

It fails because the form does not include some parameters which are required 
for the page. The page validation listener throws a redirect exception when 
these parameters are not set.

Let me further explain what I am doing ->
Some pages in my application are area dependent, i.e. a parameter area is 
required for accessing these pages. I need the area as a real parameter in 
the URL, because I use a FriendlyURL filter to make URLs like 
mysite.com/hamburg/index.html, mysite.com/london/index.html etc.
That's why I do not persist the area. 

Now when I use a form on one of my area pages which redirects to a non-area 
dependent page, then I do not include the area name as part of the form. In 
these cases my PageValidation listener jumps in and redirects me to an error 
page.



> Well, tapestry doesn't really know that you're to do a RAP. And even if
> it did,
> the PageValidationListener should still be called - perhaps the user
> doesn't have permission
> to submit the form - how would you capture this?

But I cannot capture this with the PageValidationListener either, because it 
does not tell me whether a form was submitted or just the page was accessed 
normally.


> And anyway, this is standard documented behavior of page and direct
> services.
> Howard's "Tapestry in Actions" contains several sequence diagrams that
> explain the
> process, i.e. when PageValidationListeners and PageBeginRenderListeners
> are called

Then it's perhaps a wording issue. The name "PageBeginRenderListener" implies 
to me that it is called when a page is to be rendered. But in case of RAP, no 
page is going to be rendered after the first request. 


> Why exactly don't they work? Are you persisting them somehow?
> You have to keep in mind that a RAP actually does a 2nd request , which
> means
> that unless you persist stuff, they're going to be gone after the 1st
> submit.

Yes, I am using the @Persist("session") annotation. Adding validators to the 
form text fields simply has no effect. The values are always accepted.


> That's where the tapestry-flash can help - so that you get minimum
> session usage.

Yes, I am using that for rendering some error messages, so that they disappear 
after the next action.


-- 
Bastian Voigt
Neumünstersche Straße 4
20251 Hamburg
mobil   0179/4826359

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to