{"id":1709,"date":"2012-01-27T10:16:15","date_gmt":"2012-01-27T10:16:15","guid":{"rendered":"http:\/\/salientsoft.co.uk\/?p=1709"},"modified":"2012-01-27T10:16:15","modified_gmt":"2012-01-27T10:16:15","slug":"method-call-in-rendered-attribute-is-called-again-after-navigating-to-new-form","status":"publish","type":"post","link":"https:\/\/salientsoft.co.uk\/?p=1709","title":{"rendered":"Method call in rendered attribute is called again after navigating to new form"},"content":{"rendered":"<p>Initially this looked very strange. When navigating to a new form, the rendered= methods for the old form were being called again, and were failing due to scoping issues \u2013 a new request scope bean was being created causing a null pointer exception in the method as required state had been lost.<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/7491319\/jsf-selectbooleancheckbox-not-calling-the-associated-setter-method-if-it-is-cond\"><strong>This<\/strong><\/a> post and also <a href=\"http:\/\/stackoverflow.com\/questions\/8495586\/neither-setter-nor-valuechangelistener-gets-executed-in-request-scope\"><strong>this post<\/strong><\/a> on StackOverflow explain the problem. Apparently JSF rechecks the rendered conditions after the submit as part of an attack safeguard. This is what caused recreation of a new bean and the failure.<\/p>\n<p>This behaviour was certainly unexpected, and I have not seen it documented \u2018up front\u2019 previously \u2013 so it is certainly one to be aware of! This is not the first time I have had issues with the render= attribute.<\/p>\n<p>In my case, resolving issues in creation of conversations solved the problem \u2013 once I had conversations propagating properly, everything worked correctly and the state was present for the extra calls to the rendered= methods.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Initially this looked very strange. When navigating to a new form, the rendered= methods for the old form were being called again, and were failing due to scoping issues \u2013 a new request scope bean was being created causing a null pointer exception in the method as required state had been lost. This post and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22],"tags":[13,40,184,16],"_links":{"self":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1709"}],"collection":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1709"}],"version-history":[{"count":0,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1709\/revisions"}],"wp:attachment":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}