-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
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);
window.doModal();
// 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">
<panelchildren>
<grid id="searchResult" sizedByContent="true" span="true">
<rows>
<row>1</row>
</rows>
</grid>
</panelchildren>
</panel>
</window>
</zk>
// 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
}
}
Thanks for reply watfor,
But in my case my resultMap may contain thousands of records, Is it ok to put it in session?
a sample code like Matze mentioned.
@Override public void doAfterCompose(Component window) throws Exception { super.doAfterCompose(window); if (arg.containsKey("resultObject1")) { // get the parameter from 'arg' // if needed cast it to the right object Customer cust = (Customer) arg.get("resultObject1")); } }
best
Stephan
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.
Asked: 2011-12-08 07:50:23 +0800
Seen: 371 times
Last updated: Dec 12 '11