I am aware that custom action can be done using following standard way (for jsf 2.1)
<f:metadata>
<f:viewParam name="query" value="#{bean.query}" />
<f:event type="preRenderView" listener="#(bean.action}" />
</f:metadata>
Given my request is always GET type, and with url as, /context/page1.xhmtl?query=jsf
can i invoke my custom action in setter method setQuery() instead of listener method setAction() ? Means I will be invoking my action code (such as setting corresponding view bean) in apply model values phase instead of pre render-response phase.
Please share if any downside to this approach, as this is the only way, it is working well in my application setup, and not working properly with prerender listener method.
Update: The reason for my app not working properly with prerender listener method, could be that prerender method is being called after the 'Start' of render-response, not before it. I was expecting to call my prerender listener method, before the start of render-response, ideally at the end of or right after 'invoke application' phase. Does it make sense to expect that way ? as I am thinking it is too late to be called after render response phase start.
Thanks very much.
setQuery()method will be called on postback, too. And this is just the technical side. Nobody (should) expect your setter to do anything else than, well, settingquery. To give you more well founded answer - what do you need to do you can't do with the current setup? - mabif:viewParamtags are only evaluated only for GET requests. Have a look at this. Appart from that, doing any business logic ingetter/settermethods is just wrong. - Xtreme BikerUIViewParamis that value will be validated/converted/set on postback like every otherUIInput. - mabi