This is covered in many responses in the archives of this list, and I'm sure
the wiki, but anyway, here's the basics:

If you create a new Page instance, and call setResponsePage(myInstance),
Wicket must respond with *that exact instance.*  This means that the URL
needs to be a session-specific URL that will look into your session, pull
out that specific instance, and respond to the browser with it.

For instance, you could do this:

MyPage page = new MyPage();
page.setFoo("bar");
setResponsePage(page);

If Wicket used a URL that was not session-specific, how would it know what
you set "foo" to?  It must pull up the exact instance that you created and
modified before calling setResponsePage.

Now, if you did this:

setResponsePage(MyPage.class)

Wicket now knows that you just want to respond with a default, newly created
instance of MyPage.  So, it can respond with a non-session-specific page
(the URL that you mounted the page on).   When that URL is requested, it
will create a new instance of MyPage with the default constructor, and
respond with that.

-- 
Jeremy Thomerson
http://www.wickettraining.com


On Wed, Aug 20, 2008 at 4:06 PM, miro <[EMAIL PROTECTED]> wrote:

>
> here is what i do
>
> In Application which is  WicketApplication in the init method
> mount(new
> HybridUrlCodingStrategy("/secure/index.jas/searchPCR",Foo.class,true));
>
> my form object the method onSubmit()
> calls setResponsePage(new Foo());  does this matter
> and setRedirect(true)
> and my web.xml wicket filter   is mapped to all requests
>
>    <filter-mapping>
>        <filter-name>wicket</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>
>
> I tested with this but I was getting the same wicket url and not the mount
> path, then I changed setResponsePage   to take class as parameter  and not
> instance , then it worked .How the two methods setResposnePage(new Page())
> , setResponsePage(Page.class)  differ ?
>
>
>
>
> Erik van Oosten wrote:
> >
> > Miro,
> >
> > In Nabble, please do not edit your message after you've send it. That
> > way you're message appears twice.
> >
> > Wicket will always use the mount path of the page you are forwarding to,
> > that is, if you called setResponsePage. You can also look into mounting
> > with a HybrodUrlEncoder.
> >
> > Regards,
> >     Erik.
> >
> >
> > miro wrote:
> >> After submit a form with redirect set to true , the wicket generates
>  its
> >> own
> >> url and not the mountpath.
> >> Is there a way to avoid this ?
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/url-after--submitting--a-form--with-a-redirect-tp19069918p19078053.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to