当我尝试更新已处理事件(选择框的 onValueChanged)中的组件区域时,我遇到了这个问题。
[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Failure writing parameter 'value' of component calendar/Stereotype:daycomponent.selectcategoryactivity: Property 'day' (within property expression 'day.category', of com.hb.craproject.web.components.calendar.stereotype.AddDayStereotypeComponent@3a6b9a8a) is null.
org.apache.tapestry5.ioc.internal.OperationException: Failure writing parameter 'value' of component calendar/Stereotype:daycomponent.selectcategoryactivity: Property 'day' (within property expression 'day.category', of com.hb.craproject.web.components.calendar.stereotype.AddDayStereotypeComponent@3a6b9a8a) is null. [at classpath:com/hb/craproject/web/components/calendar/stereotype/AddDayStereotypeComponent.tml, line 24]
“Day”是这样定义的参数:
@Parameter(required=true)
@Property
private DayStereotypeBean day
当组件第一次渲染时,一切正常。只有当我尝试更改所选值时,它才会崩溃并给出错误消息。
我的 DayComponents 在我的 tml 页面中是这样声明的:
<t:loop source="week" value="dayBean">
<tr style="border :0.1em solid blue; border-radius : 0.5em">
<t:day t:id="dayComponent" day="dayBean" /></tr></t:loop>
所以这是一个日豆清单。此列表在页面的 setuprender 事件处理程序中提供。
我不明白为什么 Day 参数在选择组件的事件处理程序中丢失了他的引用:
public Object onValueChangedFromSelectDuree(String duree)
{
//throwing exception, day.Day is a String, this line is just for showing you that the object doesn't exist anymore in the method, if this line is not here, the exception is throwed too because my select tml component use (like many oher components) that object
day.getDay();
return request.isXHR() ? zoneDuree.getBody() : null;
}
现在您可以看到 select tml 组件:
<t:zone t:id="zoneDuree">
<t:select t:id="selectDuree"
model="literal:journée,demi-journée,définir" value="day.duree" zone="zoneDuree" /> <!-- here some fields depending of the select value --></t:zone>
任何想法都应该受到赞赏。
(对不起,我的英语不好 ;) )