Revision history [back]

click to hide/show revision 1
initial version

answered 2021-09-22 17:58:51 +0800

hawk gravatar image hawk

http://hawkphoenix.blogsp... ZK Team

Non-static inner classes, parameter.A.AA, need an instance of the outer class to work properly. They don't "really" have a default constructor, so ZK can't instantiate it.

Even you make it a static inner class, but ZK class loader doesn't support this case. So please put that inner class into a separate class.

The correct class name for a nested class is (use a '$' to separate the nested from the outer class name '.'): apply="parameter.A$AA"

This would work for a static inner class. So in case you meant that you have to declare the inner class as static.

public static class AA { ...

Non-static inner classes, parameter.A.AAparameter.A$AA, need an instance of the outer class to work instantiate properly. They don't "really" have a default constructor, so ZK can't instantiate it.it just by the classname. Instead you have to instantiate it by providing an instance of the outer class. This can be done with the new1 taglib function.

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk>
    <window apply="${c:new1('parameter.A$AA', $composer)}" />
</zk>

$composer is the default variable referencing the outer composer.

Even you make it Here a static inner class, but ZK class loader doesn't support this case. So please put that inner class into a separate class.runnable example:

https://zkfiddle.org/sample/2ra8bng/2-instantiate-nested-non-static-class

The correct class name for a nested class is (use a '$' to separate the nested from the outer class name '.'): apply="parameter.A$AA"'.'):

apply="parameter.A$AA"

This would work for a static inner class. So in case you meant that you have to declare the inner class as static.

public static class AA { ...

Non-static inner classes, parameter.A$AA, need an instance of the outer class to instantiate properly. They don't "really" have a default constructor, so ZK can't instantiate it just by the classname. Instead you have to instantiate it by providing an instance of the outer class. This can be done with the new1 taglib function.

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk>
    <window apply="${c:new1('parameter.A$AA', $composer)}" />
</zk>

$composer is the default variable referencing the outer composer.

Here a runnable example:

https://zkfiddle.org/sample/2ra8bng/2-instantiate-nested-non-static-class

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