Hi

Where do you initialize 'cmd' ? The variable has to be initialized
somewhere. @Property only creates public setter/getter for you, you have to
create an instance yourself.

 Do something like cmd = new Command() somewhere in onActivate() before
using cmd

regards
Taha


On Sun, Apr 24, 2011 at 11:37 AM, cablepuff <cablep...@gmail.com> wrote:

> Hi I have a situation where I have a @property object.
>
>
> @Property
> private Command cmd.
>
>
> My onActivate would take an id and load it from db and set the obj
>
> onActivate(Integer databaseId) {
>     DBRecord dbRecord = myDao.getById(databaseId);
>     if (dbRecord != null) {
>          cmd.setVal(dbRecord.getValue());  <-- causes npe
>     }
> }
>
> How would I be able to load the db object from db and than setup the value
> of Object into the command.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Tapestry-5-Property-object-is-null-when-using-in-onActivate-tp4335791p4335791.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to