I think the ognl:document.id will try to call getDocument().getId() from your Home class.

--
Serge

----Original Message Follows----
From: Andreas Idl <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: Tapestry users <[email protected]>
Subject: Binding to spring object
Date: Mon, 11 Jul 2005 20:09:50 +0200

Hi!

I'm actually building a prototype of a tapestry-spring application to test if
this combination can satisfy our needs.
The sample app maps a document table from the database via a DAOBean, which
uses a HibernateTemplate. The list of all entries should be shown in a
ListEdit component in my Home.html. Instead ot the desired ListEditView I get
a Bindingexception:
Unable to resolve expression 'document.id' for
[EMAIL PROTECTED]
The document class provides all necessary getters and setters, which can be
successfully used in the pageRenderBegin function of the Home.java.

Home.html:

<tr jwcid="listEdit">
       <td><input jwcid="[EMAIL PROTECTED]" value="ognl:document.id"/></td>
      <td><input jwcid="[EMAIL PROTECTED]" value="ognl:document.name"
size="80" maxlength="100"/></td>
      <td><span jwcid="[EMAIL PROTECTED]" value="ognl:document.number"
validator="ognl:beans.numVal" displayName="Nummer"/></td>
      <td><span jwcid="[EMAIL PROTECTED]"
value="ognl:document.scale"/></td>
</tr>

My Home.page looks as follows:
<property-specification name="document"
type="at.evi.tapestryspring.spring.Document"/>
    <property-specification name="listEditMap"
type="org.apache.tapestry.form.ListEditMap"/>

<component id="listEdit" type="ListEdit">
       <binding name="source" expression="listEditMap.keys"/>
       <binding name="value" expression="listEditMap.key"/>
    <static-binding name="element" value="tr"/>
     <binding name="listener" expression="listeners.synchronizeDocuments"/>
  </component>


In my Home.java I call the the following code on the pageBeginRender event to
fillup the ListEditMap.
The logging output shows that the Documents are correctly parsed from the DB.
The Home class defines the abstract getters and setters for
listEditMap and document.

Global gl = (Global)getGlobal();
List l =
((DocumentDAO)gl.getApplicationContext().getBean("myDocumentDao")).getAllDocuments();
ListEditMap map = new ListEditMap();
int count = l.size();
for (int i = 0; i < count; i++)
{
        map.add(((Document)l.get(i)).getId(), ((Document)l.get(i)));
}
setListEditMap(map);

If someone knows how to solve the problem, or may show me what the problem's
reason is, it would be a great help.

Thanks,

Andreas

--
DI (FH) Andreas Idl EV-i Informationstechnologie GmbH.
Softwareentwicklung                      Sebastian-Kneipp-Weg 17
[EMAIL PROTECTED]                        A-6020 Innsbruck/Austria
phone: ++43-512-284883-8 fax: ++43-720-699931

---------------------------------------------------------------------
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