I am using JSF (Apache MyFaces Implementation) and Ajax4JSF framework for ajax facility. What the problem I am facing is whenever I want to have "ajax" facility for JSF pages, JSF Backing Bean needs to placed under "session" scope. So whether we require all the attributes of perticular bean are not... I am bound to put Bean instance in session scope. So is there any way out for this issue?
This is a persistent data store issue. From your description you need to store some state information about you view that needs to survive a single request transaction but does not need to be around for as long as the session.
1. My favorite is to create a view controller (bean) that you use to store information for a specific view or web page. Yes it gets stored in session scope but only contains the information you need to manage the view state. Often I get to my data through my view controller. This is the simplest solution, I recommend never using JSF (DI) directly with backing beans that are mainly data or where setters actually invoke actions. I will qualify, the backing beans should be POJO's (Hibernate, etc) or DTO's who's persistent (save, update, etc) state is managed by the view controller.
2. There are a few "state-saving" components that you can use that will store the data you need into the JSF view. Apache tomahawk has one.
3. Use a cache system or hibernate using a memory data store for objects. Advantage is that you can purge cache periodically. Put your view state into that cache.
4. Use something like JBOSS Seam. It is the Conversational state that you are wishing for.
5. Change your solution from server side to client side state saving.