开发者

JSF 2 Custom Scope usage

I am going through all the scopes in JSF2.0. I am a little confused about when to use custom Scope. Any specific use cases it will be useful.

Initially I thought I can use it for sc开发者_如何学Cope spanning multiple pages like three page registration etc. But looks like we cannot use it there.


Better late than never: I wrote an article about the usage custom scopes in JSF2 : JSF 2 Custom Scopes without 3rd party libraries


Well, the general idea is to create your own Scope for what ever you like e.g. kind of "Conversation Scope". The problem is already adressed within JSR 299 (CDI) and imho this is where it belongs to.

My attempts to create a custom scope resulted in Exceptions thrown by the JSF implementation as soon as the context is destroyed. Since it seems that there are no working examples available, custom scopes should be considered as non-existent in JSF2.0, though announced as a key feature.

Anyway, if you are looking for custom scopes take a look at CDI (escpecially Weld and MyFaces CODI), MyFaces Orchestra (for Conversation Scopes in JSF), Seam (offers a nice solution) or create a Custom Scope using Spring.

HTH

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜