JSF 2中的范围 [英] Scopes in JSF 2

查看:86
本文介绍了JSF 2中的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CRUD应用程序.在其中获取数据的位置,显示n个已编辑的n存储回db.页面和页面之间也有顺序访问.在第二页&上需要在第一页上输入的信息.以此类推.最佳范围是什么?为什么 ?

I have a CRUD application.. Where in the data is fetched, displayed n edited n stored back to db. Also there is a sequential access between pages & the information entered on the first page is needed on the second page & so forth. What would be the best scope & why ?

什么时候使用哪个范围?每个范围的生命周期是什么?

When to use which scope? What is the life-cycle of each scope.

此外,我找不到有关示波器的任何优秀教程.如果您知道相同的内容,请进行指导.

Also, I couldn't find any good tutorial on scopes. If you are aware of the same, please guide.

谢谢, 什卡(Shikha)

Thanks, Shikha

推荐答案

BalusC出色的教程

There is a detailed explanation of JSF scopes in BalusC's excellent tutorial Communication in JSF 2.0.

根据经验,我建议始终选择最窄的范围,以减少保存在服务器端的状态.如果将所有内容都保留在会话范围内,则应用程序的伸缩性将很差.如果您使用的是Ajax,则视图范围特别有用.对于非ajax视图,请求范围通常就足够了.

As rule of thumb I would recommend to always choose the most narrow scope in order to reduce the state that is saved on the server side. Your application would have a bad scalability if you kept everything in session scope. The view scope is especially useful if you are working with ajax. For non-ajax views the request scope is often sufficient.

这篇关于JSF 2中的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆