0

Create a Zk session variable with a menu

asked 2013-10-01 00:59:02 +0800

daovallec gravatar image daovallec
11 2

I have an application in ZK providers in my database, and i have my DAO to return all the names of my database.

And i have this view in ZK:

<zk>
    <window id="Mnos" border="normal" mode="modal" width="320px"
        apply="org.zkoss.bind.BindComposer"
        viewModel="@id('vm') @init('operator')">
        <listbox model="@load(vm.provider)" onClick="@command('provider', provider = each)"/>

    </window>
</zk>

I need that when a user do click in some provider, save a session variable to use in my application, because i have a crud of services and when i create a service i need create the service related with the provider that the user choose in the menu, and i need create workers and i need create a worker related with the provider that the user choose in the menu,

and i have this java class:

public class operator {

    Collection<String> provider = MnoDAO.getAllProvidersByName();

    public Collection<String> getMno() {
            return mno;
        }
    @Command
    public void saludo(@BindingParam("provider") String provider){
        Messagebox.show("Hola ... "+mnoList);
    }

}

But each is null, and second i do not know how can i save a sesion variable to use in all application, and this variable can be change when i select other provider.

Somebody can help me?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-10-01 12:33:30 +0800

cor3000 gravatar image cor3000
4466 2 7
ZK Team

updated 2013-10-02 02:19:01 +0800

Hi,

I don't understand all you are talking about so I made you sample code run, and added functionality to save and load a session attribute. Please have a look at this example code in zk fiddle.

If you click the "run" button at the top you can see it in action. Also notice, that a value stored, will still be available if you close the sample an rerun it (because it is saved to the session).

Robert

link publish delete flag offensive edit
0

answered 2013-10-01 16:27:42 +0800

daovallec gravatar image daovallec
11 2

Ok, thanks

link publish delete flag offensive 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: 2013-10-01 00:59:02 +0800

Seen: 26 times

Last updated: Oct 02 '13

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