File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Where the @NoneScoped can be applied? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Where the @NoneScoped can be applied?" Watch "Where the @NoneScoped can be applied?" New topic
Author

Where the @NoneScoped can be applied?

Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

About a good utilization the @NoneScoped, I have seen some developers saying that it is good to put the converter as a ManagedBean, to be able to do Injections.

Is NoneScoped a good scope to use in the Converters to allow the injection?

I saw in this post (http://stackoverflow.com/questions/3086896/what-is-none-scope-bean-and-when-to-use-it) that this scope would be good when used to read faces-config parameters.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16054
    
  21

I'd forgotten there even was such a thing!

The URL you referenced seems to have a good explanation. If you are coding EL and you need the EL to reference a "throwaway" bean that exists only for the duration that that particular EL expression is being evaluated, NoneScoped would be suitable. Not that I've ever needed to do that, but it would allow you to offload complex computations and other data manipulations into Java code instead of doing them in EL - which is both potentially an MVC violation and definitely a to debug,

From that usage, I think I could consider them as a UI equivalent to Session EJBs, only something between stateless and stateful; stateful EJBs would retain scope between uses, whereas the NoneScoped beans would simply be discarded.


Customer surveys are for companies who didn't pay proper attention to begin with.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Tim Holloway wrote:I'd forgotten there even was such a thing!

The URL you referenced seems to have a good explanation. If you are coding EL and you need the EL to reference a "throwaway" bean that exists only for the duration that that particular EL expression is being evaluated, NoneScoped would be suitable. Not that I've ever needed to do that, but it would allow you to offload complex computations and other data manipulations into Java code instead of doing them in EL - which is both potentially an MVC violation and definitely a to debug,

From that usage, I think I could consider them as a UI equivalent to Session EJBs, only something between stateless and stateful; stateful EJBs would retain scope between uses, whereas the NoneScoped beans would simply be discarded.
I do think as you, but do you think that would be a good usage to a converter as NoneScoped? Instead the RequestScoped?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16054
    
  21

I don't know. I don't do Converters as Managed Beans, so I don't scope them, myself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where the @NoneScoped can be applied?