Hi, The page loads address panel with couple of text fields . When the search is made for a particular address id, the address panel is rendered twice (one panel with the data, the second panel without the data). Not sure how to avoid re-rendering of panel twice,
setResponsePage(getPage()) can be a solution, but I dont want the whole page to be refreshed as I am using 4 panels in my page. The code is as below. Not sure if there is a problem in the way the markup is structured. Appreciate your help in this regard. /************AddressPanel.html***************/ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en"> <body> <wicket:panel> <tr> <th>Adr1:</th> <td align="left"><input type='text' wicket:id="address" size='30' maxlength='45'/></td> </tr> <tr> <th align='right'>Adr2:</th> <td align="left"><input type='text' wicket:id="address2" size='30' maxlength='45'/></td> </tr> </wicket:panel> </body> </html> /****************AddressPanel.java***************/ public class AddressPanel extends Panel { public AddressPanel(String id, IModel model) { super(id); setDefaultModel(new CompoundPropertyModel(model)); add(new RequiredTextField("address")); add(new TextField("address2").setConvertEmptyInputStringToNull(false)); } } /************* java file that instantiates the panel *************/ final Panel shipAddressPanel = new AddressPanel("shipperAddressPanel", new Model(address.getShipAddress())); shipAddressPanel.setOutputMarkupId(true); mawbForm.add(shipAddressPanel); add(mawbForm); final TextField shipIdTf = new TextField("shipperId", new PropertyModel(dtomodel, "shipperId")); shipIdTf.setOutputMarkupId(true); mawbForm.add(shipIdTf); shipIdTf.add(new AjaxFormComponentUpdatingBehavior("onBlur"){ private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { Shipper shipper= shipDao.loadShipAddress(Long.parseLong(shipIdTf.getDefaultModelObjectAsString())) Address address = new Address(); address.setShipAddress(shipper); shipAddressPanel.setDefaultModelObject(address.getShipAddress()); target.addComponent(shipAddressPanel); } }); /********* the template that calls the panel ***********/ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head></head> <body> <form wicket:id="form"> <table><tr> <td valign='top' style="width:8em;height:15em;"> <table width='100%' border='1' cellpadding='1' cellspacing=''> <tbody> <tr> <td class='instrLabelColor' colspan="2" align='center'>SHIP From: <input type='text' wicket:id="shipperId" /> </td> </tr> <tr wicket:id="shipperAddressPanel"></tr> </tbody> </table> </td> </tr></table> </form> </body> </html> Thanks J -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Panel-re-rendered-twice-when-the-data-is-pulled-in-tp2268924p2268924.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org