开发者

JSF: How to get client browser attributes (height, width) to backing bean [duplicate]

开发者 https://www.devze.com 2023-02-08 18:13 出处:网络
This question already has an answer here: How to invoke a JSF managed bean on a HTML DOM event using native JavaScript?
This question already has an answer here: How to invoke a JSF managed bean on a HTML DOM event using native JavaScript? (1 answer) Closed 4 years ago.

What's the best way to get client screen attributes to my backing bean? I'd like to work out some dynamic sizing and popup positioning. The application is built with ICEfaces/JSF2.0.

I'开发者_JS百科m thinking of having a javascript function assigning the client attributes to the value attribute of a hidden input and then grabbing it from there, but I was hoping for something less cumbersome.

Any ideas?


You may have to use filters to determine the screen size and redirect to the specific url to display


I solved this myself by writing a Java Servlet and a JavaScript function that obtains the window size and makes a HTTP request to pass this information to the servlet. Both the servlet and JSF Managed Beans have access to the HTTP Session ID so I know which web client the HTTP request has come from.

0

精彩评论

暂无评论...
验证码 换一张
取 消