Hi,
I have a problem in one of my pages where I want to loop over a List of
CompApprovalSiteContactDTO object that contains two private members
(currentSiteContactDTO and pendingSiteContactDTO). In this class I also have
two extra boolean methods that returns true or false if I have the current
or pending object. My problem is that I got a
org.apache.tapestry.BindingException like this:

org.apache.tapestry.BindingException
Unable to read OGNL expression '<parsed OGNL expression>' of
[EMAIL PROTECTED]: source is null
for getProperty(null, "siteContact")
binding:        ExpressionBinding[CompWebSiteApprovalPage
businessCardListEntry.pendingSiteContactDTO.siteContact.siteContactId]
location:       context:/html/secure/complience/CompWebSiteApprovalPage.page,
line 256, column 105
251     <component id="isHavingPendingSiteContactDTO" type="Insert" >
252     <binding name="value"
value="businessCardListEntry.isHavingPendingSiteContactDTO" />
253     </component>
254     
255     <component id="pendingSiteContactId" type="Hidden" >
256     <binding name="value"
value="businessCardListEntry.pendingSiteContactDTO.siteContact.siteContactId"
/>
257     </component>
258     
259     <component id="pendingName" type="Insert" >
260     <binding name="value"
value="businessCardListEntry.pendingSiteContactDTO.siteContact.name" />
261     </component>
 
org.apache.hivemind.ApplicationRuntimeException
Unable to read OGNL expression '<parsed OGNL expression>' of
[EMAIL PROTECTED]: source is null
for getProperty(null, "siteContact")
component:      [EMAIL PROTECTED]
location:       context:/html/secure/complience/CompWebSiteApprovalPage.page,
line 5, column 106
1       <?xml version="1.0"?>
2       <!DOCTYPE page-specification PUBLIC "-//Apache Software
Foundation//Tapestry Specification 4.0//EN"
3       "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
4       
5       <page-specification
class="com.investacorp.ui.web.action.securepages.complience.CompWebSiteApprovalPage">
6       
7       <component id="titleTag" type="Insert">
8       <binding name="value" value="titleTag"/>
9       </component>
10      
 
ognl.OgnlException
source is null for getProperty(null, "siteContact")

This is a example layout for the 3 differant alternative I have for each row
that I loop over.

-----------------------------------
| -------------                    |
| |     C     |                   |   (Alt 1 : Only Current Business Card)
| --------------                   |
|                                  |
| -------------   --------------   |
| |     C     | |       P    |  |   (Alt 2: Both current and pending
Business Card)
| --------------  --------------   |
|                                  |
|                 --------------   |
|                 |       P    |  |  (Alt 3: Only pending business Card)
|                 --------------   |
------------------------------------

The object class looks like this:
public class CompApprovalSiteContactDTO implements Serializable,
ICompArticleContainerDTO {

        private static final long serialVersionUID = 1L;
        
        /* PRIVATE MEMBERS */
        private SiteContactDTO currentSiteContactDTO;
        private SiteContactDTO pendingSiteContactDTO;
        
        /* CONSTRUCTORS */
        public CompApprovalSiteContactDTO() {
                super();
        }
        
        /* GETTERS AND SETTERS */
        public SiteContactDTO getCurrentSiteContactDTO() {
                return currentSiteContactDTO;
        }

        public void setCurrentSiteContactDTO(SiteContactDTO 
currentSiteContactDTO)
{
                this.currentSiteContactDTO = currentSiteContactDTO;
        }

        public boolean getIsHavingPendingSiteContactDTO() {
                return pendingSiteContactDTO != null ? true : false;
        }

        public boolean getIsHavingCurrentSiteContactDTO() {
                return currentSiteContactDTO != null ? true : false;
        }

        public SiteContactDTO getPendingSiteContactDTO() {
                return pendingSiteContactDTO;
        }

        public void setPendingSiteContactDTO(SiteContactDTO 
pendingSiteContactDTO)
{
                this.pendingSiteContactDTO = pendingSiteContactDTO;
        }
        
}

In my .page file I have this:
<!-- TABLE -->
        <property name="businessCardListEntry" />  
        <component id="eachMainEntry" type="For" >
                <binding name="source"
value="compContactUsDTO.compApprovalSiteContactDTOList" />
                <binding name="element" value="literal:tr" />
                <binding name="value" value="businessCardListEntry" />  
        </component>

        <!-- CURRENT BUSINESS CARD -->
        <component id="isHavingCurrentSiteContactDTO" type="Insert" >
                <binding name="value"
value="businessCardListEntry.isHavingCurrentSiteContactDTO" />
        </component>

        <component id="currentSiteContactId" type="Hidden" >
                <binding name="value"
value="businessCardListEntry.currentSiteContactDTO.siteContact.siteContactId"
/>
        </component>

        <component id="currentName" type="Insert" >
                <binding name="value"
value="businessCardListEntry.currentSiteContactDTO.siteContact.name" />
        </component>
        
        <component id="currentTitle" type="Insert" >
                <binding name="value"
value="businessCardListEntry.currentSiteContactDTO.siteContact.title" />
        </component>
        
        <component id="currentImageName" type="Insert" >
                <binding name="value"
value="businessCardListEntry.currentSiteContactDTO.siteContact.imageName" />
        </component>
        
        <component id="currentDateCreated" type="Insert" >
                <binding name="value"
value="businessCardListEntry.currentSiteContactDTO.siteContact.dateCreated"
/>
        </component>
        
        <component id="currentDateApproved" type="Insert" >
                <binding name="value"
value="businessCardListEntry.currentSiteContactDTO.siteContact.dateApproved"
/>
        </component>
        
        <!-- TABLE FOR CURRENT DETAILS -->
        <property name="currentBusinessCardDetailEntry" />
        <component id="eachCurrentDetailEntry" type="For" >
                <binding name="source"
value="businessCardListEntry.currentSiteContactDTO.siteContactDetailList" />
                <binding name="element" value="literal:tr" />
                <binding name="value" value="currentBusinessCardDetailEntry" /> 
        </component>

        <component id="currentSiteContactDetailId" type="Hidden" >
                <binding name="value"
value="currentBusinessCardDetailEntry.siteContactDetailId" />
        </component>

        <component id="currentSiteContactDetailName" type="Insert" >
                <binding name="value" 
value="currentBusinessCardDetailEntry.name" />
        </component>

        <component id="currentSiteContactDetailValue" type="Insert" >
                <binding name="value" 
value="currentBusinessCardDetailEntry.value" />
        </component>

        <!-- PENDING BUSINESS CARD -->
        <component id="isHavingPendingSiteContactDTO" type="Insert" >
                <binding name="value"
value="businessCardListEntry.isHavingPendingSiteContactDTO" />
        </component>
        
        <component id="pendingSiteContactId" type="Hidden" >
                <binding name="value"
value="businessCardListEntry.pendingSiteContactDTO.siteContact.siteContactId"
/>
        </component>

        <component id="pendingName" type="Insert" >
                <binding name="value"
value="businessCardListEntry.pendingSiteContactDTO.siteContact.name" />
        </component>
        
        <component id="pendingTitle" type="Insert" >
                <binding name="value"
value="businessCardListEntry.pendingSiteContactDTO.siteContact.title" />
        </component>
        
        <component id="pendingImageName" type="Insert" >
                <binding name="value"
value="businessCardListEntry.pendingSiteContactDTO.siteContact.imageName" />
        </component>
        
        <component id="pendingDateCreated" type="Insert" >
                <binding name="value"
value="businessCardListEntry.pendingSiteContactDTO.siteContact.dateCreated"
/>
        </component>
        
        <component id="pendingDateApproved" type="Insert" >
                <binding name="value"
value="businessCardListEntry.pendingSiteContactDTO.siteContact.dateApproved"
/>
        </component>
        
        <!-- TABLE FOR PENDING DETAILS -->
        <property name="pendingBusinessCardDetailEntry" />
        <component id="eachPendingDetailEntry" type="For" >
                <binding name="source"
value="businessCardListEntry.pendingSiteContactDTO.siteContactDetailList" />
                <binding name="element" value="literal:tr" />
                <binding name="value" value="pendingBusinessCardDetailEntry" /> 
        </component>

        <component id="pendingSiteContactDetailId" type="Hidden" >
                <binding name="value"
value="pendingBusinessCardDetailEntry.siteContactDetailId" />
        </component>

        <component id="pendingSiteContactDetailName" type="Insert" >
                <binding name="value" 
value="pendingBusinessCardDetailEntry.name" />
        </component>

        <component id="pendingSiteContactDetailValue" type="Insert" >
                <binding name="value" 
value="pendingBusinessCardDetailEntry.value" />
        </component>

And my html file look like this:
<table>
<tr jwcid="eachMainEntry">
         <td>
                <div>
                        <!-- Current Business Card -->
                        <span jwcid="@If" 
condition="isHavingCurrentSiteContactDTO"> 
                                <div>
                                        <input type="hidden" 
jwcid="currentSiteContactId" />
                                        <span jwcid="currentName">John 
Doe</span>
                                        <span 
jwcid="currentTitle">Director</span>
                                        <span 
jwcid="currentImageName">myImage.jpg</span>
                                        <span 
jwcid="currentDateCreated">2006-12-11</span>
                                        <span 
jwcid="currentDateApproved">2006-12-11</span>
                                        <table>
                                                <tr 
jwcid="eachCurrentDetailEntry">
                                                        <td>
                                                                <div>
                                                                        <input 
type="hidden" jwcid="currentSiteContactDetailId" />
                                                                        <span 
jwcid="currentSiteContactDetailName">Phone</span>
                                                                        <span 
jwcid="currentSiteContactDetailValue">555-111-2233</span>
                                                                </div>
                                                        </td>
                                                </tr>
                                        </table>
                                </div>
                        </span>
                        <!-- Pending Business Card -->
                        <span jwcid="@If" 
condition="isHavingPendingSiteContactDTO"> 
                                <div>
                                        <input type="hidden" 
jwcid="pendingSiteContactId" />
                                        <span jwcid="pendingName">John 
Doe</span>
                                        <span 
jwcid="pendingTitle">Director</span>
                                        <span 
jwcid="pendingImageName">myImage.jpg</span>
                                        <span 
jwcid="pendingDateCreated">2006-12-11</span>
                                        <span 
jwcid="pendingDateApproved">2006-12-11</span>
                                        <table>
                                                <tr 
jwcid="eachPendingDetailEntry">
                                                        <td>
                                                                <div>
                                                                        <input 
type="hidden" jwcid="pendingSiteContactDetailId" />
                                                                        <span 
jwcid="pendingSiteContactDetailName">Phone</span>
                                                                        <span 
jwcid="pendingSiteContactDetailValue">555-111-2233</span>
                                                                </div>
                                                        </td>
                                                </tr>
                                        </table>
                                </div>
                        </span>
                </div>
        </td>
</tr>
</table>

Thanks for your help,
Jacob
-- 
View this message in context: 
http://www.nabble.com/Problem-generating-content-based-on-a-conditional-statement%21-tf2796443.html#a7802435
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to