Re: Prepare for submit handler seems to be not called

2016-05-25 Thread Thiago H de Paula Figueiredo
On Wed, 25 May 2016 08:48:17 -0300, Jaroslav Ciml wrote: Hi Barry, Hello, Jaroslav! This pattern (form data groupped in DTO, simple initialization for POST requests in prepare for submit handler, more complex initialization for GET requests in prepare for render handler) is used about

Re: Prepare for submit handler seems to be not called

2016-05-25 Thread Jaroslav Ciml
Hi, there are just two assignments to formData: @OnEvent(value = EventConstants.PREPARE_FOR_RENDER, component = "searchForm") void prepareForRender() { formData = new ServiceSearchFormData(); // more initialization here, i.e. calling setters like formData.setCity(DEFAULT_CITY_NAME); } .

Re: Prepare for submit handler seems to be not called

2016-05-25 Thread Cezary Biernacki
Hi, @Barry, yes, your solution should fix null pointer exception, but probably it would break the application. A better way: public SearchFormData getFormData() { if (formData == null) { formData = new SearchFormData(); } return formData; } However, it is still interesting that fo

Re: Prepare for submit handler seems to be not called

2016-05-25 Thread Jaroslav Ciml
Hi Barry, thanks for nice hint. I cannot fix it so simply just by adding this one-line method but it shows the way to go anyway. This pattern (form data groupped in DTO, simple initialization for POST requests in prepare for submit handler, more complex initialization for GET requests in prepa

Re: Prepare for submit handler seems to be not called

2016-05-25 Thread Barry Books
It's difficult to say why it might be null but changing the code to public SearchFormData getFormData() { return new SearchFormData(); } should fix it On Monday, May 23, 2016, Jaroslav Ciml wrote: > Hi, > > I am getting a strange exception during submit of a Tapestry form that I > cannot ex