I am trying to pass an object from one page (a page with a grid) to another
page (the page with BeanDisplay).

I know am making a silly mistake somewhere but i have spent 2 hours on it
and i still cant figure out the issue.

Here is the page with the grid

<html t:type="layout" t:title="Show all contacts"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
      xmlns:p="tapestry:parameter">


      <div class="span-6">
          <div t:type="menu"/>
      </div>

      <div class="span-16">
              <table  t:type="grid" t:source="contacts" t:row="contact"
t:add="Actions">
                  <p:actionscell>
                       <t:actionlink t:id="delete" t:context="contact.id
">delete</t:actionlink>|
                       <t:actionlink t:id="view" t:context="contact.id
">view</t:actionlink>
                  </p:actionscell>
              </table>
      </div>

</html>

public class ShowAll {

    @Inject
    private Dao dao ;

    @Property
    private Contact contact ;

    @InjectPage
    private ViewContact viewContact ;

    public List<Contact> getContacts(){
        return dao.getAll();
    }

    @OnEvent(value="action", component="delete")
    private void deleteContact(Long id){
        dao.delete(id, Contact.class);
    }

    @OnEvent(value="action", component="view")
    private Object viewContact(Long id){
        Contact contact = dao.getById(id, Contact.class);
        viewContact.setContact(contact);
        return viewContact ;
    }

}


The view page

<html t:type="layout" t:title="Show all contacts"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
      xmlns:p="tapestry:parameter">

      <div class="span-6">
          <t:menu title="Viewing Contact"/>
      </div>

      <div class="span-16">
          <t:beandisplay object="contact"/>
      </div>

</html>

package com.josh.addressbook.pages;

import com.josh.addressbook.entities.Contact;

public class ViewContact {


    private Contact contact  ;

    public Contact getContact() {
        return contact;
    }

    public void setContact(Contact contact) {
        this.contact = contact;
    }


}


Error message

An unexpected application exception has occurred.

   - org.apache.tapestry5.internal.services.RenderQueueException
   Render queue error in SetupRender[ViewContact:beandisplay]: Parameter
   'object' of component ViewContact:beandisplay is bound to null. This
   parameter is not allowed to be null.
   activeComponents
      - ViewContact (class com.josh.addressbook.pages.ViewContact)
      - ViewContact:layout (class com.josh.addressbook.components.Layout)
      classpath:com/josh/addressbook/pages/ViewContact.tml, line 31<html
      t:type="layout" t:title="Show all contacts"2 xmlns:t="
      
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"3xmlns:p="tapestry:parameter";>
      4
      5 <div class="span-6">6 <t:menu title="Viewing Contact"/>7 </div>8
      - ViewContact:beandisplay (class
      org.apache.tapestry5.corelib.components.BeanDisplay)
      classpath:com/josh/addressbook/pages/ViewContact.tml, line 105 <div
      class="span-6">6 <t:menu title="Viewing Contact"/>7 </div>8
      9 <div class="span-16">10 <t:beandisplay object="contact"/>11 </div>12
      13</html>
   locationclasspath:com/josh/addressbook/pages/ViewContact.tml, line 10
   - org.apache.tapestry5.ioc.internal.util.TapestryException
   Parameter 'object' of component ViewContact:beandisplay is bound to null.
   This parameter is not allowed to be null.
   locationclasspath:com/josh/addressbook/pages/ViewContact.tml, line 10Hide
   uninteresting stack frames Stack trace
      - 
org.apache.tapestry5.internal.transform.ParameterWorker$2$1.readFromBinding(ParameterWorker.java:328)

      - 
org.apache.tapestry5.internal.transform.ParameterWorker$2$1.get(ParameterWorker.java:413)

      - 
org.apache.tapestry5.corelib.components.BeanDisplay._$get_object(BeanDisplay.java)

      - 
org.apache.tapestry5.corelib.components.BeanDisplay.setupRender(BeanDisplay.java:128)

      - 
org.apache.tapestry5.corelib.components.BeanDisplay$MethodAccess_setupRender_12c2b7e6fa2.invoke(BeanDisplay$MethodAccess_setupRender_12c2b7e6fa2.java)

      -
      
org.apache.tapestry5.internal.transform.RenderPhaseMethodWorker$Invoker.invoke(RenderP

Reply via email to