Revision history [back]

click to hide/show revision 1
initial version

answered 2014-03-12 20:27:48 +0800

chillworld gravatar image chillworld flag of Belgium

https://github.com/chillw...

You can use an global command :

the caller code :

Map<String,Object> args = new HashMap<String,Object>();
args.put("data", "postX");
BindUtils.postGlobalCommand(null, null, "doSomeThing", args);

the receiver code :

@GlobalCommand
public void doSomeThing(@BindingParam("data") String data){
    //Data is now filled in and you can use here. 
}

Take attention that default scope is Desktop, but that is normally good enough.

Greetz chill.

You can use an global command :

the caller code :

Map<String,Object> args = new HashMap<String,Object>();
args.put("data", "postX");
BindUtils.postGlobalCommand(null, null, "doSomeThing", args);

the receiver code :

@GlobalCommand
public void doSomeThing(@BindingParam("data") String data){
    //Data is now filled in and you can use here. 
}

Take attention that default scope is Desktop, but that is normally good enough.

if you want to use eventQueue see this page :

http://books.zkoss.org/wiki/ZKDeveloper'sReference/EventHandling/EventQueues

Greetz chill.

You can use an global command 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 :

the caller code sender :

Map<String,Object> args = new HashMap<String,Object>();
args.put("data", "postX");
BindUtils.postGlobalCommand(null, null, "doSomeThing", args);
Executions.sendRedirect("second.zul?username=MyName");

the receiver code :

@GlobalCommand
public void doSomeThing(@BindingParam("data") String data){
    //Data is now filled in and you can use here. 
}
Executions.getCurrent().getParameterMap().get("username");

Take attention that default Option 2 : Store it in your session scope is Desktop, but that is normally good enough.

if you want to use eventQueue see this page :

http://books.zkoss.org/wiki/ZKDeveloper'sReference/EventHandling/EventQueuesstore 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.

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 :

Executions.getCurrent().getParameterMap().get("username");
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.

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);

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.

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