0

how to access an enum class in a zul page?

asked 2014-08-27 10:07:12 +0800

salbader gravatar image salbader
15 5

Hello, how to access an enum class in a zul page?

i try like this:

<include src="/WEB-INF/pages/zul/my.zul" value="${Enum.value1}"/>
delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-08-27 10:39:59 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

See below code

 public enum Status {
        Open("Open"), 
        Closed("Closed"), 
        Reopened("Reopen"), 
        Suspend("suspend"),
        Duplicaed("duplicated");

        final String value;

        Status(String value) {
            this.value = value;
        }
    };

zul file

<zk>

  <zscript>
    import pkg$.Status;
    ListModelList model = new ListModelList(Status.values()); //use enum class's values as model.
  </zscript>

  <combobox id="combo" model="${model}" onChange='alert(self.getValue());' />

</zk>
link publish delete flag offensive edit

Comments

Hello, thanks for your help. Is it possible without zscript ?

salbader ( 2014-08-27 13:54:19 +0800 )edit

Yes why not define zscript code in your java class

sjoshi ( 2014-08-27 14:11:50 +0800 )edit
0

answered 2014-08-28 02:23:15 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

You can also define your Variable Resolver in zul

http://books.zkoss.org/wiki/ZKDeveloper'sReference/UIComposing/ZUML/ELExpressions#Variable_Resolver

link publish delete flag offensive edit

Comments

ok thanks a lot i will try

salbader ( 2014-09-03 07:30:22 +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-08-27 10:07:12 +0800

Seen: 63 times

Last updated: Aug 28 '14

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