Ahah - I think I'm starting to see the light...

Thanks for the hints.



Mr Mean wrote:
> 
> Don't add wicket components to the session, use models.
> for example
> class MySession extends WebSession
> {
>  private IModel dropdown1=new WhateverModel(null); //etc for the others
>  // add getters() for models
> }
> 
> class PanelSearch extends Panel
> {
>  public PanelSearch(String id)
> {
>  super(id);
>  add(new
> DropDownChoice("dropdown1",((MySession)Session.get()).getDropdown1(),myChoices)
> }
> }
> 
> class SomePage extends WebPage
> {
>  public SomePage()
> {
>  super();
>  add(new PanelSearch("search"));
> }
> }
> 
> The trick is always using the shared models in your session, that is
> why you don't need setters for them and you have to initialize them
> properly with some default.
> That way the form automatically writes the new values to your session
> and you don't have to do that manually.
> 
> How much less code can you have?
> 
> Maurice
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15611982.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