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
-igor
If so... it all makes sense to me now... :-)
Very smart, too!
On Wed, 2007-07-04 at 07:34 -0700, Igor Vaynberg wrote:
> On 7/4/07, David Leangen <[EMAIL PROTECTED]> wrote:
>
>
>
> What I can't figure out here is this: when the form's submit
> button gets
> pressed on the current page, obvious a new HttpServletRequest
> gets sent to
> the server, and the onSubmit() method gets invoked.
>
> 1. What URL is sent to the server?
>
> the url that is defined in form.action attribute in html. it tells
> wicket that the form has been submitted, pointing out which one.
>
> 2. Since the response can differ according to the input
> of the form, this means that the URL could change
> according to the input... but the URL is already
> decided on in step 1
>
> the url is the same but the post values are different.
>
>
> -igor
>
>
>
>
-------------------------------------------------------------------------
> 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
-------------------------------------------------------------------------
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
-------------------------------------------------------------------------
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