I am using ZK Ajax Framework and am using Java code to control the components. The idea is to create two labels dynamically with two different values "Label 1" and "Label 2" and append them to two different components i.e. vlayout1 and vlayout2. But, when I try this code, a label is attached to each of the vlayout but the value of both the labels is "Label 2". I am not sure what's wrong, how do I fix this such that the values of labels are created dynamically?
I am not sure if the question is appropriate in this forum but I think the issue is with my Java code (perhaps the way I am using the static class) and not something very specific to ZK. It would be great if someone helps me figure this out. Please see the simplified version of my code below:
sony vijay wrote:But, when I try this code, a label is attached to each of the vlayout but the value of both the labels is "Label 2". I am not sure what's wrong, how do I fix this such that the values of labels are created dynamically?
I wouldn't stake my life on it, but I certainly don't like the look of
static String value; in your TestComponent class. Why is it static?
If you truly want the class to be static (and I'm not at all sure you do) then you should include a private default constructor.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here