-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I assumed that in Spring-ZK @Autowired annotation autowires components within its bean scope. But seems it autowires the whole desktop components regardless of the bean scope which seems very illogical to me. In my case, I have window which is bound to controller of "idscope" bean scope. Scoping itself works fine, creates new bean when new window is created. I'm using them within tabs. The problem arises when I open multiple tabs of the same window, which happens to have components of the same ID as the @Autowire annotation depends on the component id to bind to correct component. Instead of binding to newly created component it binds to old tabs component which it finds first. Is there a way to use autowiring only for components inside the specified controller? If not then how to use reusable components? Especially in environment where multiple tabs could display same content from .zul file?
Here is how the beginning of the tab .zul looks like:
<window id="studentsWindow" width="100%" height="100%" apply="${studentsController}">
<grid id="studentsGrid" rowRenderer="@{studentsController.rowRenderer}" mold="paging" hflex="true" vflex="true">
studentsGrid autowired component on the seconds time gets bound to first tab grid not the second one.
Problem solved. I removed all reusable components from .zul only left window component there which I applied controller and in controller I created child components manually and bound them to class variables, since "idspace" scope is working fine now the problem is solved.
Asked: 2011-07-24 11:37:48 +0800
Seen: 578 times
Last updated: Jul 25 '11