Re: Some Redirect after Post issues
Did you try to use @Persist("client:page") ? this will encode your property in a hidden form field (and in links URLs, so the become quite ugly) - but you don't need the hidden fields... Cheers, Ron Bastian Voigt wrote: Andreas Andreou schrieb: Since the form is in an 'area page' and tapestry's submits trigger the same page (i.e. the listeners are found on the current page) it's only normal that the validation listener will complain... Can't you include the current area as a hidden form field, so that it gets submitted and your validation listener gets satisfied? Yes, this is my actual workaraound for the problem. But this means that I need to add the hidden field to each and every form component that might be used on an area page. This is not what I would call intuitive. If ever someone else is to work on my code and add another form, he/she will be totally confused by the error thrown by the page validation listener, imho. This, (though I dislike it) could also work: http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200512.mbox/[EMAIL PROTECTED] Maybe I'll try that one :-) I could make an empty page which is used only for redirect-after-post and which has no page validation listener or begin render listener. However, this is also quite confusing since the listeners are in a separate class... Regards Bastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Some Redirect after Post issues
Bastian Voigt wrote: > > Andreas Andreou schrieb: >>> >>> Since the form is in an 'area page' and tapestry's submits trigger the >>> same page >>> (i.e. the listeners are found on the current page) it's only normal >>> that >>> the >>> validation listener will complain... >>> Can't you include the current area as a hidden form field, so that it >>> gets submitted >>> and your validation listener gets satisfied? >>> > Yes, this is my actual workaraound for the problem. But this means > that I need to add the hidden field to each and every form component > that might be used on an area page. or create AreaForm, your own Form component that handles this transparently to its users! Perhaps there's an even cleaner solution... it eludes me -- Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr Tapestry / Tacos developer Open Source / J2EE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Some Redirect after Post issues
Andreas Andreou schrieb: Since the form is in an 'area page' and tapestry's submits trigger the same page (i.e. the listeners are found on the current page) it's only normal that the validation listener will complain... Can't you include the current area as a hidden form field, so that it gets submitted and your validation listener gets satisfied? Yes, this is my actual workaraound for the problem. But this means that I need to add the hidden field to each and every form component that might be used on an area page. This is not what I would call intuitive. If ever someone else is to work on my code and add another form, he/she will be totally confused by the error thrown by the page validation listener, imho. This, (though I dislike it) could also work: http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200512.mbox/[EMAIL PROTECTED] Maybe I'll try that one :-) I could make an empty page which is used only for redirect-after-post and which has no page validation listener or begin render listener. However, this is also quite confusing since the listeners are in a separate class... Regards Bastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Some Redirect after Post issues
Bastian Voigt wrote: > 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. > Since the form is in an 'area page' and tapestry's submits trigger the same page (i.e. the listeners are found on the current page) it's only normal that the validation listener will complain... Can't you include the current area as a hidden form field, so that it gets submitted and your validation listener gets satisfied? This, (though I dislike it) could also work: http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200512.mbox/[EMAIL PROTECTED] > > > >> 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. > Can't you try cycle.getParameter or something? > > >> 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. > > > -- Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr Tapestry / Tacos developer Open Source / J2EE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Some Redirect after Post issues
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]
Re: Some Redirect after Post issues
Bastian Voigt wrote: > Additionally, it seems that even pageBeginRender is called when using > redirect > after post. Now this really makes no sense does it? > It makes perfect sense to me ! (See more inline) > > On Tuesday 12 December 2006 10:50, Bastian Voigt wrote: > >> Hi *, >> >> In my project (tap 4.02) I make heavy use of the redirect-after-post >> pattern with listeners such as this: >> >> public ILink onSubmit() >> { >> ... >> return getLinkService().getLink(...); >> } >> >> 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? >> My >> question is: is it really necessary for tapestry to call this listener in >> case of redirect-after-post? 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? 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 >> From my point of view it would be sufficient >> when it is called after the redirect. >> >> Second, I also noticed that form validation with delegates does not work >> with redirect-after-post. 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. That's where the tapestry-flash can help - so that you get minimum session usage. >> So for all forms that need to be validated, I >> cannot use this pattern which is not so nice. Has this been changed in >> newer tapestry versions? >> >> Regards >> Bastian Voigt >> > > -- Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr Tapestry / Tacos developer Open Source / J2EE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Some Redirect after Post issues
Additionally, it seems that even pageBeginRender is called when using redirect after post. Now this really makes no sense does it? On Tuesday 12 December 2006 10:50, Bastian Voigt wrote: > Hi *, > > In my project (tap 4.02) I make heavy use of the redirect-after-post > pattern with listeners such as this: > > public ILink onSubmit() > { > ... > return getLinkService().getLink(...); > } > > 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. My > question is: is it really necessary for tapestry to call this listener in > case of redirect-after-post? From my point of view it would be sufficient > when it is called after the redirect. > > Second, I also noticed that form validation with delegates does not work > with redirect-after-post. So for all forms that need to be validated, I > cannot use this pattern which is not so nice. Has this been changed in > newer tapestry versions? > > Regards > Bastian Voigt -- 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]