Thank you , I found a way to solve this :

myLink.add(new Image("hexagramImage" , new PropertyModel(model , "index")
    {
      @Override
      public Object getObject()
      {
        int index = ((Integer)super.getObject()).intValue();
        return new ResourceReference(MyObject.class , "icons/byIndex/"+
index+".gif");
      }
    }));

It seems working now...


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

> Hello smallufo:
>
> the onclick and the onbeforerender methods will be called if page is
> presented
> (or immidiatly before). But this
> >   myLink.add(new Image("hexagramImage" , new
> > ResourceReference(MyObject.class , "icons/byIndex/"+ new
> > PropertyModel(model,"index").getObject().toString()+".gif")));  //FAILED
> will be called at custruction time of page. So there could be two possible
> causes for your problem.
> 1st: the bean which is assigned to panel model is null or
> 2nd: the index in that bean is null.
> 1st solution: Assign a bean - if not possible make getMyObjectFromInts
> null-aware and return a "default-image"
> 2nd solution: Assign a standard value for index (int = 0)
>
> I hope i got the issue - if not please ask again :-)
> HTH
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to