-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I have a java file which has constant declaration.
Can i get the constant directly in zhtml using EL .
In older versions we get them from in the zscript and use them in zhtml.
<zscript>Tab_create = com.vzbi.Iamconstants.Tab_Create</zscript>
we use it as ${Tab_create}
Is there a way to access that Iamconstants.Tab_Create directly in zhtml.
do you mean access constant without zscript?
try composer
assume we have 2 java beans as follows
test.constant.TestConstant
package test.constant; public class TestConstant { public static String consStr = "the constant value"; }
and
test.composer.TestComposer
package test.composer; import org.zkoss.zk.ui.util.GenericComposer; public class TestComposer extends GenericComposer { public String getConstant() { return test.constant.TestConstant.consStr; } }
then we can get constant value by TestComposer in zul file as follows:
<zk> <window id="win" title="test win" border="normal" apply="test.composer.TestComposer"> <textbox value="${win$composer.constant}" /> </window> </zk>
ben
Asked: 2011-06-15 02:51:49 +0800
Seen: 359 times
Last updated: Jun 15 '11