问题描述
是否有任何状态保存方法允许JSF应用程序在服务器上初始保存状态数据但在会话到期时间间隔之后,该状态将转移到客户端,以便即使在服务器和放大器上的会话超时之后,应用程序也始终响应;内存在服务器上管理得更好?
Are there any state saving method that would allow JSF application to intially save state data on server but after the session expire time interval , that state is transferred to client so that app is always responsive even after the session timeout on the server & memory is better managed on server?
或者这可以实现吗?但我希望这应该是JSF规范的一部分!
Or any way this could be implemented? But I expect that this should be a part of the JSF specification !
在BalusC提出建议后,我对。如果其他任何人也对将无状态JSF添加到JSF规范感兴趣,请考虑查看或投票。
After suggestion by BalusC, I'm highly impressed with the Stateless JSF principles & the current implementation for it. If anyone else here is also interested in stateless JSF being added to the JSF spec, consider having a look at or voting this issue.
无状态JSF为某些支付提供了巨大的性能提升,例如无法动态创建视图(例如通过绑定,JSTL标记等)或修改它。
Stateless JSF offers huge performance boosts for some payoffs like inability to create views dynamically (e.g. by binding, JSTL tags, etc), or modifying it.
以前Jacob建议:
This has previously been suggested by Jacob: http://weblogs.java.net/blog/jhook/archive/2006/01/experiment_goin.html
这将有助于JSF放弃慢速和记忆力的耻辱,而b $ b有助于跟上当前的科技趋势s(无状态架构。)
This would help JSF ditch the stigma of "slow and memory hog," and help keep up with current tech trends (stateless architectures.)
推荐答案
技术上如何可行?如果下一个请求将创建新会话,则服务器永远不能可靠地预测,因此当前请求的响应必须使用客户端状态保存而不是服务器端状态保存。如果您使用普通的JSP / Servlet成功实现它,请随意发布JSF规范增强请求。
How is that technically possible? The server can never reliably predict beforehand if the next request would create a new session and thus the response of the current request has to use client side state saving instead of server side state saving. If you ever succeed to implement it using plain JSP/Servlet, feel free to post a JSF specification enhancement request.
只需使用客户端状态保存并确保部分状态保存已启用。与完全状态保存相比,开销相对较小。
Just use client side state saving and make sure that partial state saving is enabled. The overhead is relatively minor as compared to full state saving.
请注意,可以完全使用无状态的JSF。另请参见。唯一的主要收益是你不能动态创建视图(例如通过绑定
,JSTL标签等),也不能在创建后操纵它(例如通过添加/删除组件的子项)。
Note that it's possible to use JSF entirely stateless. See also this blog. The only major payoff is that you can't create views dynamically (e.g. by binding
, JSTL tags, etc), nor manipulate it after creation (e.g. by adding/removing component's children).
- Why JSF saves the state of UI components on server?
这篇关于JSF State最初保存到服务器&会话超时转移到客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!