Igor,

> hope this helps some

Yep. Helps me to understand how this works. Very clever. Thanks!

Hopefully it will also help Philip, who was asking the questions about
this.


Cheers,
Dave




On Wed, 2007-07-04 at 20:31 -0700, Igor Vaynberg wrote:
> On 7/4/07, David Leangen <[EMAIL PROTECTED]> wrote:
>         
>         Thanks, Igor, that makes sense.
>         
>         But still one more question before I really understand
>         onSubmit():
>         
>         I could have this in my onSubmit:
>         
>         if( isValidated )
>           setResponsePage( PageOne.class );
>         else 
>           setResponsePage( PageTwo.class );
>         
>         
>         So, what gets sent back in the HttpServletResponse is
>         different
>         according to the validation of the form (data being sent via
>         POST and
>         handled in the background by Wicket). 
>         
>         Are you saying that in either case, the URL would be the same
>         (i.e. the
>         one generated by Wicket magic and seen in the html of the
>         form), but the
>         content of reply would be different depending on whether it's
>         PageOne or 
>         PageTwo?
> 
> this is what happens in a nutshell
> 
> you pull up a page that has a form, wicket has already generated an
> action url for that form that points back to that page. this url
> cannot be "pretty" because it points to a specific instance of a page
> wicket holds in session. 
> 
> you submit the form, the url in action is invoked and hits the page,
> along with page parameters in post.
> 
> lets say validation fails - that means your form.onsubmit() is never
> called. what wicket does is redirect to a url that will render the
> current page again back to the user (it doesnt have to redirect, but
> it does by default - see redirect-after-post pattern for details).
> this url also cannot be "pretty" because it points to a specific
> instance of a page in session - this is the url you will see when
> validation fails. 
> 
> now if validation succeeds and your onsubmit() is called which does
> setresponsepage(MyPage.class) then you will be redirected to a
> "pretty" url given that MyPage is mounted.
> 
> now if you want to maintain pretty url throughout then you might want
> to try using a statelesspage and a stateless form. however, notice
> that you would only be allowed to have stateless components on that
> page (components that do not generate a callback back to themselves -
> images, regular Links, etc) 
> 
> 
> hope this helps some
> 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to