how to Access httpsession in portletsession

Hi,

I have a problem with accessing httpsession attribute in portletsession,

I am able to get the session set inside the portletsession as shown in the below code,

Servlet class code,

-

request.getSession(false).setAttribute(IPConstants.PRODUCTS+ownerId,products);

RequestDispatcher dispatcher = getServletContext().getRequestDispatcher( response.encodeURL("/ip/invPrc") );

dispatcher.forward( request, response );

portlet class code,(inside doview)

-

PortletSession session = request.getPortletSession(false);

if((RenderRequest)session.getAttribute("Invoice_Search_ses",1)!=null){

request = (RenderRequest)session.getAttribute("Invoice_Search_ses",1);

}

but when I try to set a attribute in httpsession inside servlet,

note :this time the servlet call was made thro the activexobject(ajax) from jsp as shown below,

reqobj = new ActiveXObject("MSXML2.XMLHTTP.3.0");

reqobj.open("POST", "<%=IPHelper.getContextPath(request)+"/"+IPConstants.SERVLET_URL_INVOICE_SEA RCH%>", true);

reqobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

reqobj.onreadystatechange = loadSearchHandler;

reqobj.send(parameters);

servlet code,

--

request.getSession(false).setAttribute("Test_Naveen","Naveen");

out.print("<" + IPConstants.SERVLET_RESULT_ROOT + ">");

.

.

.

out.print("</" + IPConstants.SERVLET_RESULT_ROOT + ">");

i am not able to access the above session attribute in the portletsession.

I doubt since it is a call thro ajax, the session attribute is not applied on to the application scope. is there any other way to set the httpsession explicitly in the application scope which i am missing?

please help me in resolving this ?.

[1872 byte] By [Naveenperia] at [2007-11-26 17:23:54]
# 1

hi,

to share a session attr between a portlet and a servlet, you need to access the attribute in the application scope of the portlet ...

Object o = portletRequest.getPortletSession(true).getAttribute(name, PortletSession.APPLICATION_SCOPE);

you can then access the same attr from the HTTP session ...

Object o = request.getSession(true).getAttribute(name);

farble1670a at 2007-7-8 23:51:55 > top of Java-index,Web & Directory Servers,Portal Servers...
# 2

hi farble1670,

thx for the reply, but i was able to access the session the way u have suggested. the problem which i face was while i try to set the session(inside the servlet) when the call for the servlet from the jsp was made through AJAX(means there is no page submission), this session is not goin up to the application scope.

awating for solution.......

Naveenperia at 2007-7-8 23:51:55 > top of Java-index,Web & Directory Servers,Portal Servers...