There are several ways how you can do this... To encourage losely coupled components folowing is in my opinion the best solution..
Work with a callback mechanism. let's say you define a callback interface SaveCallback with a method onSaved(AjaxRequestTarget target). The component that uses you panel/form, can pass such a callback to define de 'code' that needs to be executedn once the Link is saved. class MyPage { public MyPage() { //construct panels.... final Panel otherPanel = new ..... otherPanel.setOutputMarkupId(true); //make it possible to refresh this panel via ajax add(otherPanel); add(new NewLinkPanel("newLinkPanel",new SaveCallback() { onSaved(AjaxRequestTarget target) { target.addComponent(otherPanel);//refresh other panel } }); } } On Thu, Dec 17, 2009 at 11:31 AM, marioosh.net <marioosh....@gmail.com>wrote: > 2009/12/17, Pieter Degraeuwe <pieter.degrae...@systemworks.be>: > > However, I never do it like this. I always use PropertyModels() to 'map' > my > > TextFields to properties of my object. This way your code in the > onClick() > > method uses that just the object properties. (Note that the > AjaxSubmitLink > > has no onClick(), but a onSubmit()...) > > > > Pieter > > Thanks Pieter. I got working this like below: > > public class NewLinkPanel extends Panel { > public NewLinkPanel(String id) { > super(id); > add(new LinkForm("linkform")); > } > } > > class LinkForm extends Form { > > public LinkForm(String id) { > super(id); > > 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) {} > }); > } > > @Override > protected void onSubmit() { > Link l = (Link)this.getModelObject(); > new LinkDAO().save(l); > } > } > > > Now i want to update (refresh) my another panel with list of links on my > page :D > That will be a problem for me now. I'm beginner.... > > -- > Greetings, > marioosh > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Pieter Degraeuwe Systemworks bvba Belgiƫlaan 61 9070 Destelbergen GSM: +32 (0)485/68.60.85 Email: pieter.degrae...@systemworks.be visit us at http://www.systemworks.be