javaservletsmvvmzkzkoss

Event/information pass from servlet to ZK Mvvm


How to forward an event/information from java servlet controller to ZK MVVM model. Basically, i have some informations into servlet layer but based on data, i need to process into ZK UI layer. I couldn't use ZK event queues/Global commasnd as it requires current exections. Also, i don't have any third event queue system.

Posting an event/request from servlet and recieve into ZK MVVM layer.


Solution

  • If you just need to share data, then you can store the data in a session attribute and get it from ZK ViewModel. (see https://www.zkoss.org/wiki/ZK%20Developer's%20Reference/Integration/Accessing%20Java%20EE%20Scope%20Objects)

    If you need to actively send an event to notify ZK ViewModel, then you need to use session-scope event queue. Only desktop event queue requires an Execution.

    Since a HttpServlet cannot access a desktop, you cannot send an event via a desktop-scope event queue.