Another session problem :(

Hello Everybody,

I have an issue with session in JSF application where am using a Servlet filter .

When i code like this

servletconfig.getServletContext().setAttribute ("profile", profileObject);

Though object gets placed in session but later when i try to get it in my backing bean as below

Profile objProfile =(Profile) request.getAttribute("profile");

I donot get this object? Wondering why my session is lost.

On the other hand if i use following piece of code it works perfect.

ServletContext ctx = filterConfig.getServletContext();

LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);

Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

FacesContextFactory factory =(FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);

FacesContext context = factory.getFacesContext( (Object) ctx,(Object)objHttpServletRequest, (Object)objHttpServletResponse, lifecycle);

context.getExternalContext().getSessionMap().put("profile", profileObject);

Any reason why it is so? Am using RAD 6.0 and WAS6.0

Thanx.

[1225 byte] By [princea] at [2007-11-26 22:38:18]
# 1

You've put an attribute in the ServletContext and you're trying to retrieve it from the HttpServletRequest and you're talking about session problems (which is usually to be referred to HttpSession).

What's wrong here? =)

Just put the attribute in the HttpSession and retrieve it from the HttpSession.

BalusCa at 2007-7-10 11:50:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
OOPS. ! Well i appreciate your response butActually this the code i used to put in sessionobjHttpSession = objHttpServletRequest.getSession(true);objHttpSession.setAttribute("profile",profileObject);Thanks,
princea at 2007-7-10 11:50:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...