0

We are using JSF 2.1.10 & mojarra and I don't see we will upgrade to 2.2 or 2.1.18 any time soon because of some other dependencies.

Now, I want to use ViewScope for my managedBean as i have some ajax functionality. If i use requestScope, it keep on creating new objects everytime I call ajax function. And I know that if I use ViewScoped then I need to make sure all the objects in the bean should implement Serializable, if not it throws NotSerializableException. And I cannot do that because in my bean i need to use some objects where I cannot change them to implement Serializable. Since I am using mojarra I cannot use this as a solution.

Is there anything in mojarra to say false to serialization?

Community
  • 1
  • 1
nani21984
  • 911
  • 2
  • 13
  • 21
  • What exactly are the responsibilities of those "objects" which made it impossible to let them implement serializable? Do they really belong in a view scoped bean? – BalusC Feb 20 '14 at 09:29
  • They are stored in jar file comes from core project which internally got lots of different objects. Cannot extend it. As they are struct classes which we use to map & send them to Corba server. They actually hold some data which I need to show them on the screen. I am just looking at possibility of converting to Viewscoped. They do belong to viewscoped or in internal object of the viewscoped – nani21984 Feb 20 '14 at 12:56
  • What about extending from that objects and build an auxiliary class for your `@ViewScoped`? Make it contain the info you want to show and implement `Serializable` over it. Your view shouldn't be tied to objects provided by your controller. – Aritz Mar 12 '14 at 13:36
  • Thanks for the reply. That would be a good option. I have already tried that. But the problem was, some methods return classes in the core package. When I extend them I end up overriding mutliple methods. But we have started changing the classes in the core package itself. – nani21984 Mar 17 '14 at 07:08

0 Answers0