Hi Neil!!
Is it a bad thing too, to access the session in JSF??
I do it all the time to get some beans from the session!!
Or do you answerd only the question from pdt! the access to a session
from the ejb?
naba
Neil Pitman schrieb:
Hi Pdt,
Whoa! That does not sound like a very good thing. JSF is definitely a
web-layer/presentation thing. While it might work in JBoss, accessing
the HTTP Sessions or HTTP Requests or JSF objects are a really bad idea.
Here is a short and incomplete list of bad things that could happen:
1) Web objects are not necessarily serializable, and if they are, then
modifications made in an EJB may be lost if the serialization is one way
2) Even if it works, these are big objects with complex graphs of
subobjects or sister objects, the performance hit could be large
3) JBoss is outside the EJB spec when it allows collocated web apps and
enterprise apps to see each others' class loader. Migration to other
app servers will be problematic
4) The dependencies become nightmarish
5) The appserver now depends on the JSF (again, an inversion of
dependencies) so that a webservice might need to simulate JSF
6) kiss goodbye to any hope of decoupling the webserver from the
appserver for performance reasons.
If there is data that you need from the context, like domain keys, then
these should be passed in explicitly as parameters to the session beans.
These can be fundamental types like Strings, or your own value objects.
I have spent the last 2 months trying to understand a webapp with every
kind of data item, control flag and return code in their HTTPSession
object keyed with hardcoded strings. Use simple serializable value
objects; life is easier that way.
Neil
-----Original Message-----
From: pdt_p [mailto:[EMAIL PROTECTED]
Sent: November 21, 2007 12:33 AM
To: [email protected]
Subject: Question about FacesContext
Hi...
I have 1 JSF ear, and 1 ejb ear deployed in a Jboss.
normally, we execute FacesContext.getCurrentInstance() in order to get
current facescontext. But this method will return null when you execute
it
in one of the ejb class.
is that possible to get JSF faces context from one of ejb class?
if it's possible, how to do it?
any idea
thanks
Pdt