0

Zk how to pass parameter from java code to zk page?

asked 2014-01-09 18:34:13 +0800

redwhite90 gravatar image redwhite90
1 1

updated 2014-01-09 18:36:14 +0800

I am novice in ZK.

I use very old zk framework version(legacy project).

I render zk page so:

Executions.createComponents("/myZul.zul", null, null))

I need to pass parameter to zul. And if parameter is true I need render checkbox and otherwise - not on myZul.zul

I need something like this on zul:

<zk if="${parameter}">

<checkbox id="my_id" label="my checkbox"  />

</zk>

How to pass parameter it from java code?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-01-14 09:33:20 +0800

rmuetzner gravatar image rmuetzner
22 3

You have to add parameter to your call in a map:

    Map map = new HashMap();
    map.put("person_id", person_id);

    Window win = (Window) Executions.createComponents(
            "/userDetails.zul", null, map);

    win.doModal();

In the Detail view you can read the Parameter with following code:

Map args = Executions.getCurrent().getArg();
personID = Long.parseLong(args.get("person_id").toString());
link publish delete flag offensive edit

Comments

don't forget args is only available in doAfterCompose.

chillworld ( 2014-01-15 14:14:46 +0800 )edit

Really? I have access in Constructor, too.

rmuetzner ( 2014-01-15 16:50:07 +0800 )edit

Sorry, when creatief components. See here : http://books.zkoss.org/wiki/ZUMLReference/ELExpressions/Implicit_Objects/arg

chillworld ( 2014-01-15 17:48:00 +0800 )edit
Your answer
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

Follow
1 follower

RSS

Stats

Asked: 2014-01-09 18:34:13 +0800

Seen: 38 times

Last updated: Jan 14 '14

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