Foren
Http Session
Harshal Shah, geändert vor 13 Jahren.
Http Session
Junior Member Beiträge: 49 Beitrittsdatum: 25.05.10 Neueste Beiträge
Quick question:
1. On a web/guest/home page I have deployed a login sort of portlet.
2. Every time a guest comes to this page has to put his name.
3. I sending the guest to another page where there is a different portlet which will display the information he entered in previous portlet.
4. There are only 2 portlets with only 1 instances.
5. How do I use HTTP session so that the information get passed on from one portlet to another.
6. Currently I using URL to pass the parameter which second portlet is picking up that information.
7. But is there a way I can use HttpSession for every different guest keep collecting his information as he moves along from one portlet to another.
1. On a web/guest/home page I have deployed a login sort of portlet.
2. Every time a guest comes to this page has to put his name.
3. I sending the guest to another page where there is a different portlet which will display the information he entered in previous portlet.
4. There are only 2 portlets with only 1 instances.
5. How do I use HTTP session so that the information get passed on from one portlet to another.
6. Currently I using URL to pass the parameter which second portlet is picking up that information.
7. But is there a way I can use HttpSession for every different guest keep collecting his information as he moves along from one portlet to another.
Harshal Shah, geändert vor 13 Jahren.
RE: Http Session
Junior Member Beiträge: 49 Beitrittsdatum: 25.05.10 Neueste Beiträge
To Add..eg..
3 user login in simultaneously...each will see the second portlet with his information...as again there are only 1 instances of the portlet..I am not allowing the guest to create a portlet.
Its more of a login screen...
Can anyone provide me more information on how to create our own login screen.
3 user login in simultaneously...each will see the second portlet with his information...as again there are only 1 instances of the portlet..I am not allowing the guest to create a portlet.
Its more of a login screen...
Can anyone provide me more information on how to create our own login screen.
CRM Institute, geändert vor 13 Jahren.
RE: Http Session
New Member Beitrag: 1 Beitrittsdatum: 14.09.10 Neueste Beiträge
Harshal Shah, geändert vor 13 Jahren.
RE: Solved Http Session
Junior Member Beiträge: 49 Beitrittsdatum: 25.05.10 Neueste Beiträge
Ya I got it to work....
<portlet>
....
<private-session-attributes>false</private-session-attributes>
....
</portlet>
doView() of first portlet{
HttpServletRequest diffReq = PortalUtil.getHttpServletRequest(renderRequest);
HttpSession hs = diffReq.getSession();
hs=diffReq.getSession(true);
hs.setAttribute("LIFERAY_SHARED_customerInfo",contents);
}
doView of second portlet{
HttpServletRequest diffrReq = PortalUtil.getHttpServletRequest(renderRequest);
HttpSession hs = diffrReq.getSession();
String sessionid = hs.getId();
String customerInfo=hs.getAttribute("LIFERAY_SHARED_customerInfo");
hs.removeAttribute("LIFERAY_SHARED_customerInfo");
}
Now every time a user opens a new instance of the browser. and accesss the first portlet a new session gets created which is passed on to the second portlet.
Mind you there are only 1 instance of each portlet on 1 on each different page...
I works like a login for the user
If the customer Info is missing I am redirecting to the first portlet....
<portlet>
....
<private-session-attributes>false</private-session-attributes>
....
</portlet>
doView() of first portlet{
HttpServletRequest diffReq = PortalUtil.getHttpServletRequest(renderRequest);
HttpSession hs = diffReq.getSession();
hs=diffReq.getSession(true);
hs.setAttribute("LIFERAY_SHARED_customerInfo",contents);
}
doView of second portlet{
HttpServletRequest diffrReq = PortalUtil.getHttpServletRequest(renderRequest);
HttpSession hs = diffrReq.getSession();
String sessionid = hs.getId();
String customerInfo=hs.getAttribute("LIFERAY_SHARED_customerInfo");
hs.removeAttribute("LIFERAY_SHARED_customerInfo");
}
Now every time a user opens a new instance of the browser. and accesss the first portlet a new session gets created which is passed on to the second portlet.
Mind you there are only 1 instance of each portlet on 1 on each different page...
I works like a login for the user
If the customer Info is missing I am redirecting to the first portlet....