I will try that, thanks! On Thu, Jun 5, 2008 at 11:25 AM, Gwyn Evans <[EMAIL PROTECTED]> wrote:
> In which case, maybe something along the lines of... > > MyPage() { > displayedName = ""; > setModel(new CompoundPropertyModel(new Customer(displayedName)); > Form form = new Form() { > void onSubmit() { > Customer customer = (Customer)getModelObject(); > if (!displayedName.equals(customer.getName()) { > setModelObject(new Customer(customer.getName())); > } else { > ... > } > } > add(form); > form.add(new TextField("name")); > ... > > /Gwyn > > On Thu, Jun 5, 2008 at 3:09 PM, Manuel Corrales > <[EMAIL PROTECTED]> wrote: > > Half way there :) > > > > public class MyPage extends WebPage { > > public MyPage(String name) { > > setModel(new Model(new Customer(name)); > > > > that what i want, but instead of having name as a parameter on the page > > constructor, i would like to have it from the same form the other > Customer > > data is being filled. > > > > > > On Thu, Jun 5, 2008 at 10:40 AM, Gwyn Evans <[EMAIL PROTECTED]> > wrote: > > > >> Are you looking for something like: > >> > >> public class MyPage extends WebPage { > >> public MyPage(String name) { > >> setModel(new Model(new Customer(name)); > >> ... > >> > >> /Gwyn > >> > >> On Thu, Jun 5, 2008 at 2:22 PM, Manuel Corrales > >> <[EMAIL PROTECTED]> wrote: > >> > Hi, i will rephrase. I have a class Customer on my domain, and > Customer > >> do > >> > not have a default constructor. Lets assume Customer have a > constructor > >> with > >> > a String: > >> > > >> > public class Customer { > >> > Customer(String name) { > >> > ... > >> > } > >> > } > >> > > >> > It is possible to create a wicket model, to create a new instance of > >> > Customer? I mean, if i am not getting it wrong the wicket model use > >> > accessors (get, set) to "fill" the objects, so how can i do to use the > >> > Customer constructor from a wicket model? > >> > > >> > On Wed, Jun 4, 2008 at 5:41 PM, Maurice Marrink <[EMAIL PROTECTED]> > >> wrote: > >> > > >> >> What do you mean? > >> >> If your page accepts a certain model in its constructor you can do > >> >> with it whatever you want. > >> >> Any page (with or without empty constructor) can be created from > >> >> within another page. Although typically you will do this on a link > >> >> click or form submit. > >> >> Just do setResponsePage(new MyPage(whatever_args_here); > >> >> > >> >> Maurice > >> >> > >> >> On Wed, Jun 4, 2008 at 6:27 PM, Manuel Corrales > >> >> <[EMAIL PROTECTED]> wrote: > >> >> > Hi, let assume i have a class with no empty constructors (at least > no > >> >> > publics). And i want to use a wicket page to instantiate this > class. > >> It > >> >> is > >> >> > possible to create a model for this, so i dont have to use another > >> object > >> >> or > >> >> > add setters. I dont know if i made myself clear. Please feel free > to > >> ask. > >> >> > > >> >> > Thanks in advance! > >> >> > > >> >> > Regards. > >> >> > > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> For additional commands, e-mail: [EMAIL PROTECTED] > >> >> > >> >> > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >