I encounter this issue when I am trying to update a zone of a component in a handled event (onValueChanged of a select box).
[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" is a parameter defined like this :
@Parameter(required=true)
@Property
private DayStereotypeBean day
And when the component is rendering for the first time, all works fine. It's only when I try to change the selected value that it crashes and given that error message.
My DayComponents are declared like this in my tml page :
<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>
So this is a List of Day beans. This list is feeded in the setuprender event handler of the page.
I don't understand why the Day parameter lost his reference in the event handler of the select component :
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;
}
And now you can see the select tml component :
<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>
Any idea should be appreciated.
(sorry for my bad english ;) )
The "setuprender" event only fires when your page is initially rendered. Anything initialized in setupRender() will be null in the subsequent event requests.
Here's a few options:
You might find that the builtin select / ajax update is not sufficient since you can't provide multiple context values. Take a look at the onEvent
mixin here which allows you to customise what gets passed from the client to the serverside event when a clientside event (eg change) occurs.