You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Deepak <mn...@gmail.com> on 2014/12/16 18:37:17 UTC

Re: Correct usage of BeanEditForm to auto generate form, how to ?

>
> I've started learning Tapestry with ver 5.3.7 from the book by Alexander
> Koleshnikov. I'm having problems using BeanEditForm to create a form:
>
> Render queue error in SetupRender[AddCelebrity:celebrityform.editor]:
> Exception instantiating instance of tapestry5.inaction.model.Celebrity
> (for
> component 'AddCelebrity:celebrityform.editor'):
> org.apache.tapestry5.ioc.internal.OperationException: No service
> implements
> the interface java.lang.String.
>
> Celebrity.java
> -----------------------
> public class Celebrity {
> private long id;
> private String firstName;
> private String lastName;
> private Date dateOfBirth;
> private Occupation occupation;
> private String biography;
> private boolean birthDateVerified;
>  public Celebrity() {
>  }
>  public Celebrity(String firstName, String lastName, Date dateOfBirth,
> Occupation occupation) {
> super();
> this.firstName = firstName;
> this.lastName = lastName;
> this.dateOfBirth = dateOfBirth;
> this.occupation = occupation;
> }
>
> // getter and setter methods
> }
>
>
> AddCelebrity.tml
> -----------------------
> <t:beaneditform object="celebrity"/>
>
> AddCelebrity.java
> -------------------------
> public class AddCelebrity {
>  @Persist
> @Property
> private Celebrity celebrity;
>
> }
>
> What am I doing wrong ?
>
> Thanks,
> Deepak
>

RE: Correct usage of BeanEditForm to auto generate form, how to ?

Posted by Akshay <ak...@gmail.com>.
HI Deepak, 

please have a look at the below documentation :-
http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/components/BeanEditForm.html

2. You do not need the constructor explicitly defined I believe.
And this is with java, you do not need  super in the parameterized constructor, that just calls object's constructor...which is implicit.
3.you can initialize the celebrity class in setup or begin render method of your addcelebrity.java, and everything should be fine.

Best regards 
Akshay

-----Original Message-----
From: "Deepak" <mn...@gmail.com>
Sent: ‎16-‎12-‎2014 18:37
To: "Tapestry users" <us...@tapestry.apache.org>
Subject: Re: Correct usage of BeanEditForm to auto generate form, how to ?

>
> I've started learning Tapestry with ver 5.3.7 from the book by Alexander
> Koleshnikov. I'm having problems using BeanEditForm to create a form:
>
> Render queue error in SetupRender[AddCelebrity:celebrityform.editor]:
> Exception instantiating instance of tapestry5.inaction.model.Celebrity
> (for
> component 'AddCelebrity:celebrityform.editor'):
> org.apache.tapestry5.ioc.internal.OperationException: No service
> implements
> the interface java.lang.String.
>
> Celebrity.java
> -----------------------
> public class Celebrity {
> private long id;
> private String firstName;
> private String lastName;
> private Date dateOfBirth;
> private Occupation occupation;
> private String biography;
> private boolean birthDateVerified;
>  public Celebrity() {
>  }
>  public Celebrity(String firstName, String lastName, Date dateOfBirth,
> Occupation occupation) {
> super();
> this.firstName = firstName;
> this.lastName = lastName;
> this.dateOfBirth = dateOfBirth;
> this.occupation = occupation;
> }
>
> // getter and setter methods
> }
>
>
> AddCelebrity.tml
> -----------------------
> <t:beaneditform object="celebrity"/>
>
> AddCelebrity.java
> -------------------------
> public class AddCelebrity {
>  @Persist
> @Property
> private Celebrity celebrity;
>
> }
>
> What am I doing wrong ?
>
> Thanks,
> Deepak
>

Re: Correct usage of BeanEditForm to auto generate form, how to ?

Posted by Geoff Callender <ge...@gmail.com>.
Some examples that might help:

	T5.4: http://jumpstart.doublenegative.com.au/jumpstart7/examples/input/create1
	T5.3: http://jumpstart.doublenegative.com.au/jumpstart/examples/input/create1

Geoff


On 17 Dec 2014, at 6:07 am, Thiago H de Paula Figueiredo <th...@gmail.com> wrote:

> On Tue, 16 Dec 2014 15:37:17 -0200, Deepak <mn...@gmail.com> wrote:
>>> AddCelebrity.tml
>>> -----------------------
>>> <t:beaneditform object="celebrity"/>
>>> 
>>> AddCelebrity.java
>>> -------------------------
>>> public class AddCelebrity {
>>> @Persist
>>> @Property
>>> private Celebrity celebrity;
>>> 
>>> }
>>> 
>>> What am I doing wrong ?
> 
> Add this to AddCelebrity:
> 
> void onPrepare() {
> 	if (celebrity == null) {
> 		celebrity = new Celebrity();
> 	}
> }
>>> 
>>> Thanks,
>>> Deepak
>>> 
> 
> 
> -- 
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


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


Re: Correct usage of BeanEditForm to auto generate form, how to ?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 16 Dec 2014 15:37:17 -0200, Deepak <mn...@gmail.com> wrote:
>> AddCelebrity.tml
>> -----------------------
>> <t:beaneditform object="celebrity"/>
>>
>> AddCelebrity.java
>> -------------------------
>> public class AddCelebrity {
>>  @Persist
>> @Property
>> private Celebrity celebrity;
>>
>> }
>>
>> What am I doing wrong ?

Add this to AddCelebrity:

void onPrepare() {
	if (celebrity == null) {
		celebrity = new Celebrity();
	}
}
>>
>> Thanks,
>> Deepak
>>


-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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