Yes .
In the WebPage , I add MyPanel like this :

myPanel = new MyPanel("myPanel" , new PropertyModel(this , "myobj"));
myPanel.setVisible(false);
myPanel.setOutputMarkupPlaceholderTag(true);
add(myPanel);

And in the MyPanel :

public class MyPanel extends Panel
{
  private MyObj myObj;

  public MyPanel(String id , IModel model)
  {
    super(id);
    this.myObj = (MyObj) model.getObject();

    add(new Label("xxx" , myObj.getFieldX.toString()));
    add(new Label("yyy" , myObj.getFieldY.toString()));

  }
}

Because myObj passed to MyPanel is initially null ,
In the MyPanel construction time , myObj.getFieldX , myObj.getFieldY will
throw NPEs here...

I don't know how to solve it .....



2008/5/2 Per Newgro <[EMAIL PROTECTED]>:

> The code you provided should work. The NPEs comes from within the Panel?
> So
> can you give us an example how you access the model in the panel (with an
> NPE
> throwing component)?
>
> Cheers
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to