Hi,

You can also put an @Inject annotation on the constructor you want Tapestry to use when auto-instantiating your class. This way you can have multiple constructors.

-Filip

János Jarecsni skrev:
Hi Michael,

I googled for this problem and found a response to a similar problem from
you. I followed the instructions there, and succeeded. (I had to remove the
constructor which takes arguments! from the Celebrity class - until there
was this ctr besides the no-arg, it still tried to use it, no matter what
the model wanted to do).

Now the beaneditor call is like this:

        <t:beaneditform t:model="model" t:object="celebrity">
                    <!--
            <t:parameter name="biography">
            <table cellpadding="0" cellspacing="0"><tr>
                <td><t:t5components.editor t:id="biography"
t:value="celebrity.biography"
                    t:toolbarSet="Medium" t:width="350"
t:height="200"/></td></tr>
            </table>
              </t:parameter>
                        -->
        </t:beaneditform>

Thx!
Janos
PS: I used this info:
http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html



On 22/04/2008, János Jarecsni <[EMAIL PROTECTED]> wrote:
Hi Michael,

I had a look... but it does not make too much sense for me :) Where do I
use model.remove() now? Or do you mean I should change the remove attribute
in

 <t:beaneditform t:id="celebrity" t:submitLabel="Save"
           remove="id"....

to exclude="id"? (I tried even this, but nothing changed).

As far as I see this, there is some complain about no service implementing
java.util.Date (whatever that should mean). It is obviously trying to
instantiate a model class to use for bean editing. This worked so far, now
it can't instantiate.

thx!
janos

On 22/04/2008, Michael Gerzabek <[EMAIL PROTECTED]> wrote:
Hi Janos,

take a look at the upgrade notes. Close to the bottom the change of the
BeanModel signature is documented. Now you need mode.exlude(..) instead of
model.remove(..).

Regards,
Michael

[1] http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html

János Jarecsni schrieb:

Hi,

I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked before
now
throws this:

An unexpected application exception has occurred.

Render queue error in SetupRender[AddCelebrity:celebrity.editor]:
Exception
instantiating instance of com.packtpub.celebrities.model.Celebrity
(for
component 'AddCelebrity:celebrity.editor'): Error invoking constructor
com.packtpub.celebrities.model.Celebrity(String, String, Date,
Occupation)
(at Celebrity.java:18) (for service 'BeanModelSource'): No service
implements the interface java.util.Date.

The .TML code:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
   <head>
       <title>Celebrity Collector: Adding New Celebrity</title>
       <link rel="stylesheet" href="${styles}" type="text/css"/>
   </head>
   <body>
       <h1>Adding New Celebrity</h1>

       <t:beaneditform t:id="celebrity" t:submitLabel="Save"
           remove="id"


reorder="firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography">
           <t:parameter name="biography">
           <table cellpadding="0" cellspacing="0"><tr>
               <td><t:t5components.editor t:id="biography"
t:value="celebrity.biography"
                   t:toolbarSet="Medium" t:width="350"
t:height="200"/></td></tr>
           </table>
             </t:parameter>
       </t:beaneditform>
   </body>
</html>
and the model class (Celebrity):

package com.packtpub.celebrities.model;

import java.util.Date;

public class Celebrity {
   private Date dateOfBirth;
   // some fields omitted

   public Celebrity() {
   }

   public Celebrity(String firstName, String lastName,
                   Date dateOfBirth, Occupation occupation) {
       this.firstName = firstName;
       this.lastName = lastName;
       this.dateOfBirth = dateOfBirth;
       this.occupation = occupation;
   }

   public Date getDateOfBirth() {
       return dateOfBirth;
   }

   public void setDateOfBirth(Date dateOfBirth) {
       this.dateOfBirth = dateOfBirth;
   }
   // more methods follow
}


Can you tell me what am I doing wrong?
thx
janos




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



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

Reply via email to