Java 异常:getProperty的源为null(null,“代理”)

Java 异常:getProperty的源为null(null,“代理”),java,html,tapestry,Java,Html,Tapestry,我正在学习如何使用tapestry,我不断遇到以下错误 Exception: source is null for getProperty(null, "agent") ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2203) 这是我的html页面中的代码 <tr> <td valign="center" align="right" height="30"><span class="labe

我正在学习如何使用tapestry,我不断遇到以下错误

Exception: source is null for getProperty(null, "agent")    
ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2203)
这是我的html页面中的代码

<tr>
          <td valign="center" align="right" height="30"><span class="label1"> <span key="agentDeletionSalesParentActivityType" />&nbsp;:&nbsp;</span></td>
          <td valign="center" align="left" height="30"><select jwcid="agentDeletionSalesParentActivityType@ActivityTypePropertySelection" regions="ognl:{activity.agent.region}" emptyOption="true" disabled="ognl:disabled" value="ognl:parentActivityType" /></td>
        </tr>
          <tr>
            <td valign="center" align="right" height="30"><span class="label1"> <span key="agentDeletionSalesChildActivityType" />&nbsp;:&nbsp;</span></td>
            <td valign="center" align="left" height="30"><select jwcid="agentDeletionSalesChildActivityType" regions="ognl:{activity.agent.region}" emptyOption="true" disabled="ognl:disabled" value="ognl:childActivityType" parent="component:agentDeletionSalesParentActivityType" /></td>
          </tr>

如果您需要更多的代码,我很乐意将其放在上面(将其保持在较小的位置,以免将代码堆积到页面中),有人能看到为什么会返回此异常吗?

这似乎是在说,
活动
对象在以下情况下为空:

regions="ognl:{activity.agent.region}"

不确定你是否解决了这个问题,但我面临着这个问题

您的配置和我的配置之间的区别在于嵌套对象引用

regions="ognl:{activity.agent.region}"
由于您的例外声明:

Exception: source is null for getProperty(null, "agent")    
根据我的经验,这意味着
活动
确实是空的,正如@Stephen C所说

我收到的例外情况是:

Exception: source is null for getProperty(null, "question")    
这是我的配置。希望你能从中获得一些见解

SetSecurityQuestions.page

<component id="securityQuestion1Dropdown" type="PropertySelection">
    <binding name="model" value="securityQuestion1Model"/>
    <binding name="displayName" value="message:security_question_1"/>
    <binding name="value" value="securityQuestion1.question"/> <!-- the offending line -->
</component>

希望这能有所帮助。

这不是一个真正的答案,但看起来您使用的是Tapestry的旧版本(版本4?)。由于您刚刚开始使用Tapestry,我建议您使用最新版本的Tapestry5@NathanQ:是的,我正在使用Tapestry 4,不幸的是,这是我们在这里使用的Tapestry,我无法更改,因此我必须了解这一点:/
<component id="securityQuestion1Dropdown" type="PropertySelection">
    <binding name="model" value="securityQuestion1Model"/>
    <binding name="displayName" value="message:security_question_1"/>
    <binding name="value" value="securityQuestion1.question"/> <!-- the offending line -->
</component>
<div class="formline">
    <span class="formtext">
         <span jwcid="@company:FieldLabelWithColon" 
               field="component:securityQuestion1Dropdown" 
               title="Security Question 1" 
               key="security_question1">Security Question 1</span>
        <span class="mandatory">*</span>
    </span>
    <select jwcid="securityQuestion1Dropdown" tabindex="1"/>
</div>
@Persist("session")
@InitialValue("new com.org.net.SecurityQuestion()") // the solution
public abstract SecurityQuestion getSecurityQuestion1();
public abstract void setSecurityQuestion1(SecurityQuestion securityQuestion1);