Retrieve Map passed in Executions.createComponents("/Result.zul", null , resultMap)

asked 2011-12-08 07:50:23 +0800

PrashantSavaliya gravatar image PrashantSavaliya

I have one event handler class in which i am collecting values passed from textboxes into java.utils.Map object, and pass this Map object to another page using Executions.createComponents("/Result.zul", null , resultMap). and i want to retrieve this Map object in eventHandler class of Result.zul.

// this code snipet is in my caller event handler class
org.zkoss.zul.Window window = (org.zkoss.zul.Window) Executions.createComponents("/Result.zul", null , resultMap);

// content of my Result.zul file
<zk xmlns="http://www.zkoss.org/2005/zul" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul ">
<window id="win" title="Search Result" border="normal" width="650px"
xmlns:c="client" closable="true" action="show: slideDown({duration: 10}); hide: slideUp({duration: 10})">
<panel id="mainPanel" apply="zk.listeners.ResultListener">
<grid id="searchResult" sizedByContent="true" span="true">

// content of my ResultListener class
public class BasicSearchResultListener extends GenericForwardComposer{

private static final long serialVersionUID = -8403428899316897163L;

Grid searchResult;
Page page;

public void onCreate$searchResult(Event event){
// want to retrieve resultMap here


delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2011-12-08 08:19:43 +0800

watfor gravatar image watfor
36 1

You could start by retrieving the Session object.

Session session = Sessions.getCurrent();


API in this class could help you.

link publish delete flag offensive edit

answered 2011-12-09 06:18:16 +0800

PrashantSavaliya gravatar image PrashantSavaliya

Thanks for reply watfor,

But in my case my resultMap may contain thousands of records, Is it ok to put it in session?

link publish delete flag offensive edit

answered 2011-12-09 07:22:02 +0800

Matze2 gravatar image Matze2
773 7

Look in the arg variable of your composer.

link publish delete flag offensive edit

answered 2011-12-09 09:04:58 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16

a sample code like Matze mentioned.

	public void doAfterCompose(Component window) throws Exception {

		if (arg.containsKey("resultObject1")) {
                        //  get the parameter from  'arg'
                        // if needed cast it to the right object
			Customer cust = (Customer) arg.get("resultObject1"));



link publish delete flag offensive edit

answered 2011-12-11 00:40:27 +0800

yaminglin1977 gravatar image yaminglin1977
36 2

if you using zk 6.0 rc2,the arg variable should be retrieved in VM's constructor method.when i retrieve the arg variable in event listener,i got the warn message:
2011-12-11 08:31:38,953 WARN DefaultListableBeanFactory M --> FactoryBean threw exception from getObjectType, despite the contract saying that it should return null if the type of its object cannot be determined yet
java.lang.NoSuchMethodError: org.zkoss.zk.ui.Page.getVariable(Ljava/lang/String;)Ljava/lang/Object; i can't find the answer.below is the code got the warn message:
public void check(){
map = Executions.getCurrent().getArg();
questionAnswer =(SingleChoiceAnswer)map.get("questionAnswer");


link publish delete flag offensive edit

answered 2011-12-12 12:19:50 +0800

Matze2 gravatar image Matze2
773 7

Events/Commands are kind of new requests to ZK, so they have their own execution context.
Usually you know all the arg entries you need and you can retrieve them in advance.

See also this thread for alternatives.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2011-12-08 07:50:23 +0800

Seen: 371 times

Last updated: Dec 12 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More