matej: So the new convention is that named parameters are always query string 
parameters?


Am 24.08.2010 um 02:13 schrieb Matej Knopp:

> Hi,
> 
> see the replies below
> 
> 2010/8/23 Major Péter <majorpe...@sch.bme.hu>:
>> Hi!
>> 
>> As I'm testing wicket 1.5-SNAPSHOT, I'm seeing some strange behaviors:
>> With 1.4 I've used to have url's like:
>> showuser/id/1234
>> now when I open simply the page without params, I will see the following
>> URL:
>> showuser?[0-9]+
> 
> The number after ? is page id. Since wicket is a stateful framework
> (by default) we need to track page instances.
> 
>> When I looked at the JavaDoc of the new MountMapper (which is the
>> replacement for mountBookmarkablePage), I saw that I'm having this URL,
>> because my page is not stateless.
> 
> In a way, yes. Stateless pages generally do not have page ids in URL.
> 
>> Q1: with 1.4 this was possible, because the URL contained the pagemap
>> instance number, or is there something else?
>> Q2: (a little n00b question) how can I find out which component makes my
>> page stateful?
> 
> Usually it is a component that returns false in isStateless or
> generates a stateful listener interface URL.
> 
>> 
>> when I try to hit the URL now:
>> showuser/id/1234
>> then I'm going to have indexed parameters and not named parameter with
>> 'id' name. Q3: Why is that?
> 
> Because it's not a named paramerer (by default). The URL in question
> will have two indexed parameters. id and 1234.
> Big problem in 1.4 was that there was no distinction between indexed
> parameters (part of path) and named parameters (usually part query
> string). So it was difficult to build URLs such as
> showpage/13?sort=asc
> 
> 1.5 fixes this by defining URL scheme like this:
> 
> /page/mount/path/indexed-param0/indexed-param1?named1=value1&name2=value2
> 
> Btw. you should be able to mount the url in question as
> showuser/id/{user-id}
> 
> wicket should then make user-id a named parameter.
> 
>> if I have a page with URL in browser:
>> showuser?8&id=123
>> and I rewrite the id to 124, then I'm going to still see the page for
>> 123, which is really disturbing! Q4: is there a solution for this to
>> work? Or should I make my page stateless to be able to do this?? (How?)
> 
> It is still the same page instance. Obviously in your case you take
> the page parameters into account only in page constructor. So when you
> later change the id value (but leave page id the same) nothing
> changes.
> 
> However if  you for example override page onBeforeRender() and call
> getPageParameters() there the id parameter will have proper value.
> 
>> 
>> Also how could I make Wicket to use by default the /id/1234 format
>> instead of ?3&id=1234 for link creation??
> 
> You can either set id and 1234 as indexed parameters or mount the page
> as /showuser/id/{user-id}
> 
> -Matej
> 
>> 
>> Thanks for your help.
>> 
>> Best Regards,
>> Peter Major
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


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

Reply via email to