0

?forward if

asked 2023-04-28 09:07:28 +0800

agsiegel gravatar image agsiegel
6 1

updated 2023-04-28 09:09:09 +0800

If I have a class defined at the top level not in any package, then the forward directive works and evaluates the if condition. For instance, class called "Auth" ...

<?forward uri="/login" if="${!Auth.auth()}"?>

But if I have the class in a package it does not and does not even instantiate the class. In this case the class is called "uil.Auth".

<?forward uri="/login" if="${!uil.Auth.auth()}"?>

In both cases, the "auth()" function is public static boolean.

Thoughts?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-02 10:40:34 +0800

hawk gravatar image hawk
3135 1 5
http://hawkphoenix.blogsp... ZK Team

To call a static method, you need to import

<?import util.*?>

Then call

<?forward uri="/login" if="${!Auth.auth()}"?>

See http://books.zkoss.org/zk-mvvm-book/9.5/databinding/elexpression.html

link publish delete flag offensive edit

Comments

Thank you. Worked like a charm.

agsiegel ( 2023-05-27 06:03:05 +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

RSS

Stats

Asked: 2023-04-28 09:07:28 +0800

Seen: 7 times

Last updated: May 02

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