What corresponds to line 92 in your code ?

-----Message d'origine-----
De : neo anderson [mailto:javadeveloper...@yahoo.co.uk]
Envoyé : lundi 28 septembre 2009 14:23
À : users@tapestry.apache.org
Objet : Re: Bean editor model for User already contains a property model for 
property 'account'



Now I use the folloing method to create synthetic property

                PropertyConduit accountProperty = source.create(User.class, 
"account");
                ClassPropertyAdapter cpa = access.getAdapter(User.class);
                PropertyAdapter pa = cpa.getPropertyAdapter("account");
                String dt = analyzer.identifyDataType(pa);

model.add("account",accountProperty).dataType(dt).label("Account").sortable(false);

However, it throws NullPointerException without further detail.

Caused by: java.lang.NullPointerException
        at org.jecommerce.pages.Register.getRegisterModel(Register.java:92)
        at
$PropertyConduit_12400839bf9.get($PropertyConduit_12400839bf9.java)
        at
org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58)
        ... 91 more

What additional information I need to provide (or anything is missing) so
that it won't throw this error?

Thanks for help.



Thiago H. de Paula Figueiredo wrote:
>
> Em Wed, 23 Sep 2009 17:58:08 -0300, neo anderson
> <javadeveloper...@yahoo.co.uk> escreveu:
>
>
>> I have an domain object named User, in which it has a field called
>> `account'. However, the User object only provide method getAccount(),
>> but does not
>> provide method setAccount(String account).
>
> BeanModelSource (used when a BeanModel is needed and you don't provide
> one) ignores read-only properties. It doesn't care about fields, just
> about getters and setters.
>
>> In the page object e.g. Register, in which I build a BeanModel using
>> BeanModelSource.create(User.class, ...)
>
> This method is deprecated. use createDisplayModel() or createEditModel()
> instead.
>
>> 1.) in the Register page object, BeanModel does not use
>> `BeanModel.add("account",null).label("Account").sortable(false)' method
>> to create account field.
>>
>> Error:
>> aused by: java.lang.RuntimeException: Bean editor model for User does not
>> contain a property named 'account'.  Available properties: address, name,
>> password, sex.
>
> You can't reorder a model using some property that doesn't exist.
>
>> Caused by: java.lang.RuntimeException: Bean editor model for User already
>> contains a property model for property 'account'.
>
> You can't add the same property twice in the same model.
>
>> What is the correct way to add a column that the User object doesn't
>> provide get/set method at the same time?
>
> For BeanEditForm or BeanEditor, you'll need to provide your own
> PropertyConduit to model.add(String property, PropertyConduit conduit).
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>

--
View this message in context: 
http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25644707.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




Ce message et les pièces jointes sont confidentiels et réservés à l'usage 
exclusif de ses destinataires. Il peut également être protégé par le secret 
professionnel. Si vous recevez ce message par erreur, merci d'en avertir 
immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant 
être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra 
être recherchée quant au contenu de ce message. Bien que les meilleurs efforts 
soient faits pour maintenir cette transmission exempte de tout virus, 
l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne 
saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for 
the addressee; it may also be privileged. If you receive this e-mail in error, 
please notify the sender immediately and destroy it. As its integrity cannot be 
secured on the Internet, the Atos Origin group liability cannot be triggered 
for the message content. Although the sender endeavours to maintain a computer 
virus-free network, the sender does not warrant that this transmission is 
virus-free and will not be liable for any damages resulting from any virus 
transmitted.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to