I am currently using ejb3 in my action class. My problem is that I have a form which spans over multiple pages. All pages of the form call the same action. I am using a stateful session bean in my action class but the bean gets reset every time the action gets called. How can I stop the bean from initialising every time the action is called. I thought that stateful session beans hold state and that if you perform a jndi lookup on the bean, it will retuen an existing bean if it exists of course. I have not removed my bean so I expected the JNDI to find my active bean.
Could I possibly pass the bean into the request. If so then is it not easier for me to use DTO's.
You could store the bean as a session object if the amount of data it holds is not too big or number of users too great. Granted, stateful beans should maintain there information so long as you do not remove/terminate them so its probably a programming issue.
Keep in mind, stateless session beans are *FAR MORE* useful in practice than stateful because of their element of reusability. For large enough systems, stateless session beans are used in conjunction with session objects and database-managed sessions. The fact that methods in a stateful session bean may have preconditions before they can be called makes them very difficult to reuse internally. [ October 15, 2007: Message edited by: Scott Selikoff ]