Injecting Guice managed object into JSF View Scoped bean
In previous post, I demonstrate how to integrate JSF with Guice and MyBatis. However, my friend experiences some problem when he is using view scoped backing bean. He found that he cannot re-inject the service class after serialization. I have done some tricks to solve this problem.This is simply done by overriding the readObject() and writeObject() method. The BasePageBean in the previous post is changed as follow: BasePageBean.java package org.borislam.view; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import javax.annotation.PostConstruct; import javax.faces.context.FacesContext; import javax.faces.context.Flash; import javax.servlet.ServletContext; import com.google.inject.Inject; import com.google.inject.Injector; import com.ppstation.PpContext; public abstract class BasePageBean implements Serializable{ private transient Injector injector; public BasePageBean() {} pu...