your welcome. Sorry for confusing but with zk you can add pages to masterpage and so on what mostly creates headaches to people
chillworld ( 2014-03-13 22:21:51 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I need to communicate objects (data) between two pages .
Oke, now I get it.
If you are gonna do a sendRedirect to another page, you some options.
Option 1: Do a GET to that zul :
sender :
Executions.sendRedirect("second.zul?username=MyName");
receiver :
String username = Executions.getCurrent().getParameter("username");
Option 2 : Store it in your session scope :
store it :
User currentUser = new User();
Session session = Sessions.getCurrent();
session.setAttribute("user", currentUser);
get it from session :
Session session = Sessions.getCurrent();
User currentUser =(User) session.getAttribute("user");
Option 3 : Do a POST method :
well, search for yourself and you will find it how to do it, lots of examples online and with one of the 2 above it will work also.
Hope this helps you.
Greetz chill.
your welcome. Sorry for confusing but with zk you can add pages to masterpage and so on what mostly creates headaches to people
chillworld ( 2014-03-13 22:21:51 +0800 )editok, so this a simple exemple i make to test it between 2 pages a.zul et b.zul
a.zul(sender)
<?page title="a" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal" apply="NouvaPoule.Elevage.controller.aC">
<textbox id="t"/>
<button id="b" label="go"/>
</window>
</zk>
a.controller
`public class aC extends SelectorComposer<window> { @Wire Textbox t;
@Listen("onClick=#b")
public void aa() throws IOException {
Map<String,Object> args = new HashMap<String,Object>();
args.put("data", t.getValue());
BindUtils.postGlobalCommand(null, null, "doSomeThing", args);
Executions.sendRedirect("b.zul");
} }`
b.zul ( receiver)
<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal" apply="NouvaPoule.Elevage.controller.bC">
<label id="l"/>
</window>
</zk>
b.controller
public class bC extends SelectorComposer<window>{
private static final long serialVersionUID = 1L;
@Wire Label l; @Override public void doAfterCompose(Window comp) throws Exception { super.doAfterCompose(comp);
}
@GlobalCommand
public void doSomeThing(@BindingParam("data") String data){
l.setValue(data);
}
} `
ah lols oke, I get it, your 2 pages aren't included in one page? so one pc has screen A and other pc has screen B open?
chillworld ( 2014-03-13 16:13:04 +0800 )editno in the same pc ! the click on the button should redirect me to page b and the data show appears in page b.
BenAmarMahdi ( 2014-03-13 17:04:17 +0800 )editplease , is there anything to add to ZUL pages ?? because i have tried the same solution from the beggining and it didn't work.
post your code and we we will show you where it goes wrong (zul and vm/controller the important piece only) and in what scope are your 2 pages?
chillworld ( 2014-03-13 13:43:24 +0800 )editAsked: 2014-03-12 18:20:20 +0800
Seen: 45 times
Last updated: Mar 13 '14
@NotifyChange not refresh textbox
Problem binding values to a composite component
How to access static member field of a class in zul without zscript
How can i load a constant in .zul
MVVM Validator: class not found ? [closed]
MVVM tab box - delay @load until tab pane displayed?
mvvm, load or save with after or before for seach command
how to fire an event when a variable value loaded through VM