Autowire's component/bean declared in Java class (extending GenericForwardomposer) fail to bind view's component when using ZK Webflow
Symptom:
- Example, there are two zul page which handled by FlowHandler. First from with 1 textbox (Login Name) and 2 buttons (Next page, Login).
- In the Java, there is autowire for Login Name. So, the method onClick$login() is able to get the value from the textbox when the login button is clicked.
- If the "Next page" button is clicked (e.g. self="@{action(next) }" is assigned). Next ZUL is show without any problem.
- However, if the flow go back to first page or reach end-state (in XML). For whatever I type in the textbox, the value cannot be read from the java. It will read previous data/instance I typed.
- Create a session managed bean (note: implements Serializable). It can be managed by either (1) Spring, or (2) FlowScope
- Save the data from component values to a bean attributes. Handled by
- on Transit. - If it is necessary, the bean value can be retrieved from ZUL
- In the Java file, setup the autowire variable so it can be accessed by the class methods.
- "session.invalidate()" mehtod will invalidate the session so the Controller class will be initialized once again. Therefore, the autowire will be setup once again too. It can be called like
- To initialize the bean within the flowScope, place the initializer in
, example: - To initialize the bean within Spring, put the
tag in application-context.xml, example:
沒有留言:
發佈留言