It is indeed a better (more proper) way to do it your way, but the Link
object will be serialized as well, since it is not a DetachableLoadableModel
if I'm not mistaking...



On Thu, Dec 17, 2009 at 6:15 PM, Juan Carlos Garcia M.
<[email protected]>wrote:

>
> Pieter, passing the [*final *Link link = new Link();] object to the
> anonymous
> AjaxSubmitLink will Serialize the the link object itself.
>
> why not using the form.getModelObject() from the form parameter in
> ajaxsubmitl...@onsubmit()?
>
> *new LinkDAO().save(form.getModelObject())*;
>
>
>
> Pieter Degraeuwe wrote:
> >
> > class LinkForm extends Form {
> >        private AddLinkCallback callback;
> >        public LinkForm(String id, *final *AddLinkCallback callback) {
> >                super(id);
> >                this.callback = callback;
> >
> >                *final *Link link = new Link();
> >                this.setModel(new Model(link));
> >                add(new TextField("name", new PropertyModel(link,
> > "name")));
> >                add(new TextField("address",new PropertyModel(link,
> > "address")));
> >                add(new AjaxSubmitLink("ok"){
> >                        @Override
> >                        protected void onSubmit(AjaxRequestTarget target,
> > Form form) {
> >                            *new LinkDAO().save(l)*;
> >                            callback.onAdd(target);
> >                        }
> >                });
> >        }
> >
> >        @Override
> >        protected void onSubmit() {
> >                 System.out.println("ok");
> >                 Link l = (Link)this.getModelObject();
> >                new LinkDAO().save(l);
> >
> >                 callback.onAdd(target ????); //
> > ???????????????????????????
> >        }
> > }
> > On Thu, Dec 17, 2009 at 3:02 PM, marioosh.net
> > <[email protected]>wrote:
> >
> >>
> >>
> >>
> >> Pieter Degraeuwe wrote:
> >> >
> >> > I don't have the habit to exend from Form, since I don't need to put
> >> logic
> >> > there (I put it in my submitLinks/buttons)
> >> >
> >> > On Thu, Dec 17, 2009 at 2:45 PM, Pieter Degraeuwe <
> >> > [email protected]> wrote:
> >> >
> >> >> Use the onSubmit(AjaxRequestTarget target) of your AjaxSubmitLink
> >> instead
> >> >> of your form.
> >> >> (Note that if you make use of FeedbackPanel, youd should also
> override
> >> >> the
> >> >> onError() method of that ajaxlink to 'refresh' your feedback panel)
> >> >>
> >> >
> >>
> >> At first I wanted to do this in onSubmit of AjaxSubmitLink, but i've
> >> problem
> >> to get name and address components inside this method :(
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Accessing-Page-components-tp26824375p26828432.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]
> >>
> >>
> >
> >
> > --
> > Pieter Degraeuwe
> > Systemworks bvba
> > Belgiƫlaan 61
> > 9070 Destelbergen
> > GSM: +32 (0)485/68.60.85
> > Email: [email protected]
> > visit us at http://www.systemworks.be
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Accessing-Page-components-tp26824375p26831586.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]
>
>


-- 
Pieter Degraeuwe
Systemworks bvba
Belgiƫlaan 61
9070 Destelbergen
GSM: +32 (0)485/68.60.85
Email: [email protected]
visit us at http://www.systemworks.be

Reply via email to