In the portlet, the request is divided into two types of Renderrequet and actionrequest and the portlet needs to get the instance ID when it is renderrequest to be taken, the following example
bool session_start(void); initialize session
bool session_destroy(void): Delete server-side session related files.
string session_id() The id of the current session
string session_name() The name of the currently accessed session, which is the name of the cookie that the client saves the session ID. Default
PHPSESSID.
array session_get_cookie_params() The details of the session associated with this session.
string session_cache_limiter() controls the client-side caching of pages that use the session
ini session_cache_expire() Control client cache time
bool session_destroy() Delete the file that saves session information on the server side
void session_set_cookie_params (int lifetime [, string path [, string domain [, bool
secure [, bool httponly]]]]) Set the details of the session associated with this session
bool session_set_save_handler (callback open, callback close, callback read, callback
write, callback destroy, callback gc) define the function of processing session, (not using the default method)
bool session_regenerate_id([bool delete_old_session]) assign a new session id
In the case of actionrequest is not the ID of the Portlet instance, actionrequest just the current page all the things passed in, in the middle after portletacition did the processing, It is not advisable to take portletid in Portletaction, but it has been provided in Liferay to allow us to get the instance ID code of the portlet in Actionrequest as follows
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
System.out.println("portletDisplay---->"+portletDisplay.getInstanceId());
System.out.println("portletDisplay getId---->"+portletDisplay.getId());
System.out.println("portletDisplay getPortletName---->"+portletDisplay.getPortletName());
This allows you to take the corresponding Portlet instance ID that we need.
Where Webkeys.theme_display is the Liferay in the interface constant corresponding to the name is Theme_display
This article is a reprint of the article, the source of the article is http://www.cnblogs.com/edwardlauxh/archive/2010/03/26/1918614.html
How to get the ID and Portletid of an instance in Liferay