Hmm - "should" isn't really correct - "could", yes, but not "should".

Personally, I'd suggest a single CompondPropertyModel, set for the
form, if not the page, as that can really cut down on the code you
need to write.

That also solves where to put any associated data, as the ModelObject
that the CPM wraps isn't restricted to /just/ the form data.  No need
for 'hidden' client-side properties!

/Gwyn

On 18/08/06, Nino Wael <[EMAIL PROTECTED]> wrote:
> Hi Sathya
>
> Yes you should use one model for each of your dropdowns.
>
> Lets say you are creating a site where you can search for books.
>
> Then you might have a drop down for author and maybe category.
>
> I guess(without knowing anything about searching and or books:)) that I would 
> create a class that holds the search criteria eg:
>
> search.java
>
> private author
> private category
>
> getter & setter methods goes here
>
> so on my wicket page i'll have the following pseudo code:
> private Search bookSearch=new Search;
> Imodel author=new Propertymodel("bookSearch.author",search);
> Imodel category=new Propertymodel("BookSearchcategory",search);
> dropdown dropAuthor=new dropdown(id, author);
> add(drop)
> dropdown dropCat=new dropdown(id,category);
> add(drop)
>
>
> button search=new Button(id){onsubmit(
> process(search))
> }
> add(search)
>
>
> I hope my simple example contributes to something usefull:)
>
> Regards Nino
>
>
> -----Original Message-----
> From:   [EMAIL PROTECTED] on behalf of sathya81
> Sent:   Fri 18-08-2006 11:00
> To:     wicket-user@lists.sourceforge.net
> Cc:
> Subject:        Re: [Wicket-user] Dropdown choices in wicket
>
>
> Thanq Nino,
>
> well, iam using a model to store the data , actually i was going through the
> example given in the http://ensode.net/wicket_first_look.html , where in the
> author creates two models , the first model to store the normal form values
> and the second model explicitly to store the dropdown selected values
> , so here my doubt is if there are around 5 drop down choices in a page,
> then should i create 5 models for each to store the selected values?
>
> --Sathya
>
>
> Nino Wael wrote:
> >
> > About the dropdown:
> >
> > Use a model, maybe a property model to hold the selected dropdown object.
> > Property models require that there are a get and setter method for the
> > supplied property. You could also use the abstractmodel and implement your
> > own thing, if per say you needed to update something else on the page
> > based on what the selected dropdown are.
> >
> > Just to sum it up, wicket does all the nifty stuff about updating the
> > model that you provide so you need only do your logic.
> >
> > Please ask if you have more questions.
> >
> >
> >
> >
> > regards Nino
> >
> >       -----Oprindelig meddelelse-----
> >       Fra: [EMAIL PROTECTED] på vegne af sathya81
> >       Sendt: fr 18-08-2006 09:02
> >       Til: wicket-user@lists.sourceforge.net
> >       Cc:
> >       Emne: [Wicket-user] Dropdown choices in wicket
> >
> >
> >
> >
> >       Hi, iam new to wicket, am going through the available examples, i dont
> >       understand  how can i capture the selected option in a drop down 
> > choice
> > in
> >       the wicket? I checked the example tutorial given in the  ensode.net 
> > but
> >       still i dont understand how to capture the selected value of the drop
> > down
> >       and display it after form submission
> >
> >       Plz help
> >
> >       one more, how to capture values from Hidden fields in wicket html 
> > page,
> > for
> >       labels you have Label class in wicket , similarly any provision for
> > hidden
> >       variable??
> >
> >       Thanks in advance
> >       Sathya
> >       --
> >       View this message in context:
> > http://www.nabble.com/Dropdown-choices-in-wicket-tf2124339.html#a5860810
> >       Sent from the Wicket - User forum at Nabble.com.
> >

-- 
Download Wicket 1.2.1 now! - http://wicketframework.org

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to