I want to detect user's screen size and than calculate and display the every component in the right place of the page.
<body onload="detectUserScreenSize()">
<f:view>
<h:form>
<a4j:jsFunction name="detectUserScreenSize" action="#{bean.detectUserScreenSize}" >
<a4j:actionparam name="screenwidth" noEscape="true" value="window.screen.width" assignTo="#{bean.screenWidth}" />
<a4j:actionparam name="screenheight" noEscape="true" value="window.screen.height" assignTo="#{bean.screenHeight}" />
</a4j:jsFunction>
.....
The best way is to avoid need to know screen size on server, or you need to re-render something after jsFunction call with new values of screenWidth/Height