We've got a problem here with passing some data from the JSP session to our session ejbs without actually passing it throught a method call(this would impact to re-open actual code and recompile it). I mean, is there a way in a session bean to get a refefence to the calling JSP session to be able to call httpsession.getAttribute? Or is there a cleaner way to do that? Is the JSP session could be bind to the same JNDI context of that session bean and that session bean could then retreive the JSP session?
Any advise would be appreciated!
No, and you can't pass a session either because it's not serializable. Even if you could, I think it would be extremely ill-advised. The whole point in a component architecture like EJB is to create a clear seperation between the presentation tier and the business logic tier (which translates into scallability, ease of maintenance, reusabillity, etc). Making a direct reference to an HTTP session in youe session bean completely binds the tiers together.
In my opinion, using EJB like this is like buying a brand new pentium-4 to calculate tips. If you don't care about the problems such a binding creates, drop EJB alltogether and put the business logic in the same tier as the presentation. Atleast then you'll have a cleaner design and a faster implementation.