You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by miro <mi...@yahoo.com> on 2008/08/20 16:15:14 UTC

url after form submit with redirect

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 ? 
-- 
View this message in context: http://www.nabble.com/url-after-form-submit-with-redirect-tp19069918p19069918.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: url after form submit with redirect

Posted by Matej Knopp <ma...@gmail.com>.
Just mount the page with HybridUrlCodingStrategy.

-Matej

On Thu, Aug 21, 2008 at 3:50 PM, miro <mi...@yahoo.com> wrote:
>
>
> Assume I  passed my instance in setResponse() method ,  in this case wicket
> generates its own url  basically from the session  ,  so this means i cannot
> expect to have the mountpath url in case of instance   in setResponse()
> method ?   and only way to have the    mountpath in url is to pass class  as
> parameter ?if this is right how can I have the mount path url   in case of
> session specific url ?
>
>
> Jeremy Thomerson-5 wrote:
>>
>> 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 <mi...@yahoo.com> 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: users-unsubscribe@wicket.apache.org
>>> > For additional commands, e-mail: users-help@wicket.apache.org
>>> >
>>> >
>>> >
>>>
>>> --
>>> 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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/url-after--submitting--a-form--with-a-redirect-tp19069918p19089181.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: url after form submit with redirect

Posted by miro <mi...@yahoo.com>.

Assume I  passed my instance in setResponse() method ,  in this case wicket
generates its own url  basically from the session  ,  so this means i cannot
expect to have the mountpath url in case of instance   in setResponse()
method ?   and only way to have the    mountpath in url is to pass class  as
parameter ?if this is right how can I have the mount path url   in case of
session specific url ?


Jeremy Thomerson-5 wrote:
> 
> 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 <mi...@yahoo.com> 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: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>> >
>>
>> --
>> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/url-after--submitting--a-form--with-a-redirect-tp19069918p19089181.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: url after form submit with redirect

Posted by Jeremy Thomerson <je...@wickettraining.com>.
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 <mi...@yahoo.com> 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: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: url after form submit with redirect

Posted by miro <mi...@yahoo.com>.
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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: url after form submit with redirect

Posted by Erik van Oosten <e....@grons.nl>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org