Re: force model update on a wicket form
This did it. Thank you very much. Greg -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/force-model-update-on-a-wicket-form-tp4594765p4596253.html Sent from the Users forum 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
How to override annotation @SpringBean
Hi everybody. First I would like to thanks you for the help you gave me. But I've got another question for you. I would like to know if it's possible to override the annotation @SpringBean ? Why do I need to do that? Let try a little simple example: I want to print this Hello Internal and in another page (or ajax panel) Hello Commercial But I would like to use the same panel and not have to do a lots of if else in my code. So here my panel code: Panel.java public class MyPanel extends CustomPanel{ private transient HelloService service; public void initService(){ service = ServiceFactory.get(helloService,getCommercialOrInternalState()); } public MyPanel(String id){ initService(); IModel model = new LoadableDetachableModel(){ load(){ service.sayHello(); } }; add(new Label(label,model)); } My services: public interface HelloService{ public String sayHello(); } public HelloServiceInternalImpl implements HelloService{ public String sayHello(){ return Hello Internal; } } public HelloServiceCommercialImpl implements HelloService{ public String sayHello(){ return Hello Commercial; } } In my applicationContext.xml file bean id=helloServiceInternal class=service.HelloServiceInternalImpl / bean id=helloServiceCommercial class=service.HelloServiceCommercialImpl / Well, this way to do can work but sometime I don't know why i've some NullpointerException then I'm asking myself if it's a good practice create the service in the constructor. And I think it's would be more elegant to write something like that: @CustomSpringBean private HelloService service; If someone have an idea he would be awesome to share it. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-override-annotation-SpringBean-tp4597030p4597030.html Sent from the Users forum 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
Re: How to override annotation @SpringBean
Hi, in case like this where I would like to reuse a custom component in different contexts, I usually make the component abstract and have the using components implement an abstract method such as getService. This way, I can pass in different beans as needed... Maybe that helps, Jürgen On 29.04.2012 23:58, myrz wrote: Hi everybody. First I would like to thanks you for the help you gave me. But I've got another question for you. I would like to know if it's possible to override the annotation @SpringBean ? Why do I need to do that? Let try a little simple example: I want to print this Hello Internal and in another page (or ajax panel) Hello Commercial But I would like to use the same panel and not have to do a lots of if else in my code. So here my panel code: Panel.java public class MyPanel extends CustomPanel{ private transient HelloService service; public void initService(){ service = ServiceFactory.get(helloService,getCommercialOrInternalState()); } public MyPanel(String id){ initService(); IModel model = new LoadableDetachableModel(){ load(){ service.sayHello(); } }; add(new Label(label,model)); } My services: public interface HelloService{ public String sayHello(); } public HelloServiceInternalImpl implements HelloService{ public String sayHello(){ return Hello Internal; } } public HelloServiceCommercialImpl implements HelloService{ public String sayHello(){ return Hello Commercial; } } In my applicationContext.xml file bean id=helloServiceInternal class=service.HelloServiceInternalImpl / bean id=helloServiceCommercial class=service.HelloServiceCommercialImpl / Well, this way to do can work but sometime I don't know why i've some NullpointerException then I'm asking myself if it's a good practice create the service in the constructor. And I think it's would be more elegant to write something like that: @CustomSpringBean private HelloService service; If someone have an idea he would be awesome to share it. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-override-annotation-SpringBean-tp4597030p4597030.html Sent from the Users forum 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Migration to wicket 1.5 and properties.xml files
Hi everyone. I'm late out with migration. And I have a problem. We got a big system using wicket. The .xml change to .properties.xml could be painful. I could just rename all xml files so I can reach the pages to check if some migration features has been successful. But the check on the migration might take some time and this is a big project. I would like to be at update with the rest of the code on the project and I have bad experience with SVN and renamed files. Is it anyway to make wicket 1.5 load the old *.xml property files? Only temporarily. Jens -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Migration-to-wicket-1-5-and-properties-xml-files-tp4597473.html Sent from the Users forum 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