Thank you again:)

I used:

@OnEvent(component = "userEditor", value=Form.PREPARE) public void
instantiateObject() {
                user = new User();
        }

This produces the form but without a dropdown of occupation.  
The user.occupation is just an occupation object and not a list so how do
you handle foreign keys in beaneditform?

--James

-----Original Message-----
From: Thiago H. de Paula Figueiredo [mailto:[EMAIL PROTECTED] 
Sent: October-27-08 9:27 AM
To: Tapestry users
Subject: Re: T5: Using with hibernate and Mysql

Em Mon, 27 Oct 2008 09:20:01 -0300, James Sherwood  
<[EMAIL PROTECTED]> escreveu:

> Thank you, it seems to have created all the classes with annotations
> correctly!

You're welcome!

> I tried to create a beaneditform off the User class but I get the error:
>
> Exception instantiating instance of com.james.taphib.entities.Users (for
> component 'AddUser:user.editor'): Error invoking constructor
> com.james.taphib.entities.Users(Occupation, String, String) (at
> Users.java:35) (for service 'BeanModelSource'):

When instantiating a class, BeanEditForm uses the same approach as the one  
used when you declare some service via ServiceBinder.bind(...). I suggest  
you to instantiate you class yourself before the form is rendered:

@OnEvent(component = "yourBeanEditFormIdHere", value=Form.PREPARE)
public void instantiateObject() {
        yourField = new Users(......);
}

The prepare event of the Form component is fired before the component is  
rendered and before the form values are set in your object(s) fields.

Another suggestions: rename your Users class to User. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


__________ Information from ESET Smart Security, version of virus signature
database 3536 (20081019) __________

The message was checked by ESET Smart Security.

http://www.eset.com

 

__________ Information from ESET Smart Security, version of virus signature
database 3536 (20081019) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to