This content has been marked as final.
Show 5 replies
-
1. Re: HttpSession and PortletSession
bsmithjj Oct 27, 2005 11:22 AM (in response to cpage)Try changing your login.jsp in the following ways:
1.) Add the Portlets tag library:<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet" %>
2.) Use <portlet:defineObjects/> tag
3.) Change your session code to use the PortletSession instead of the HttpSession
Ultimately, your page should look something like this:... <%@ taglib prefix="portlet" uri="http://java.sun.com/portlet" %> ... <portlet:defineObjects/> ... ... <% portletRequest.getSession.setAttribute("toto","youhou!!"); %> ....
BTW - in JSP, the HttpSession is an implicit object so you can access if simply using session instead of request.getSession().
Hope this helps! -
2. Re: HttpSession and PortletSession
bsmithjj Oct 27, 2005 11:23 AM (in response to cpage)Ooops - code should read:
renderRequest.getSession(...)
NOT
portletRequest.getSession(...) -
3. Re: HttpSession and PortletSession
bsmithjj Oct 27, 2005 11:24 AM (in response to cpage)OOPs one more time - should be
getPortletSession()
not getSession() -
4. Re: HttpSession and PortletSession
julien1 Oct 27, 2005 11:27 AM (in response to cpage)it is not possible because the sessions are not the same.
one thing you can do is put a jsp in your webapp containing your portlet and request dispatch to it with a cross context call similar to :req.setAttribute("blah", "blah"); RequestDispatcher rd = getServletContext().getContext("/myapp").getRequestDispatcher("/my.jsp"); rd.include(req, resp);
and in the jspString s = (String)req.getAttribute("blah"); HttpSession ses = req.getSession(); ses.setAttribute("blah", "blah");
-
5. Re: HttpSession and PortletSession
cpage Oct 28, 2005 5:00 AM (in response to cpage)"julien@jboss.com" wrote:
it is not possible because the sessions are not the same.
=> impossible to a portlet to get informations put in the httpsession of the portal ? so, what is the mecanism of that code in my portlet req.getAttribute(RenderRequest.USER_INFO ) ?"julien@jboss.com" wrote:
one thing you can do is put a jsp in your webapp containing your portlet and request dispatch to it with a cross context call similar to :req.setAttribute("blah", "blah"); RequestDispatcher rd = getServletContext().getContext("/myapp").getRequestDispatcher("/my.jsp"); rd.include(req, resp);
and in the jspString s = (String)req.getAttribute("blah"); HttpSession ses = req.getSession(); ses.setAttribute("blah", "blah");
don't understand what you mean.
i just want to share a context (ie: user role store in an other database than portal DB).
this role (may be just a string), is known by the portal at the connection of the user and have to be get by all the portlets in the page.
the portlets, with this role, ask informations to the role database to display their content.
how can i give informations from the portal to the portlets simply ?
thanks a lot ;)
Lionel