我正在使用 Portlet 到 Portlet 通信。我在一个 Portlet 中创建了 Portlet session 并设置了属性。在第二个 Portlet 中获取该属性。现在我想结束该 session 。我该怎么做?
最佳答案
如果您在另一个 portlet Controller 中捕获 session 值,只需使用
actionrequest.getPortletSession().removeAttribute("attributeName");
如果你正在使用 Session 作用域,最好使用
actionRequest.getPortletSession().removeAttribute("attributeName",scopeId);
scopeId可以是其中之一
PortletSession.APPLICATION_SCOPE or PortletSession.PORTLET_SCOPE
现在用于在 jsp 中处理 session (我宁愿不这样做),
PortletRequest portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);
portletRequest.getPortletSession().removeAttribute("attributeName");
关于java - 如何杀死/销毁 Liferay 中的 PortletSession?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20796847/