Sorry , this simple question bothers me a while , I don't know how to solve
it:
I have a MyObject model object , which is initially null.
MyPanel recevies the MyObject and prints it value field by field.
In the WebPage , I add MyPanel like this :
myPanel = new MyPanel("myPanel" , new PropertyModel(this , "myobj"));
myPanel.setEscapeModelStrings(false);
myPanel.setVisible(false);
myPanel.setOutputMarkupPlaceholderTag(true);
add(myPanel);
The problem is , because myobj is initially null ,
it will be later instantiated (and myPanel will be later switch to visible).
And in the construction time , MyPanel will throw a lot of NPE ...
How to solve it ? Thanks a lot .