Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Sidhardha N
How to get request object in liferay using struts2
February 27, 2013 11:24 AM
Answer

Sidhardha N

Rank: Junior Member

Posts: 25

Join Date: October 18, 2012

Recent Posts

HI

I tried to get the request object in struts 2 action class but failed .

Below are the ways i tried to get the object

1 By implementing the portletRequestAware,portletRespnseAware and portletContext to the action class - In this request object is NULL

2 Using PortletActionContext

PortletRequest portletRequest = PortletActionContext.getRequest((); - Request object is null
RenderRequest renderRequest =PortletActionContext.getRenderRequest((); - Request object is null
ActionRequest actionRequest = PortletActionContect.getActionReques();t - Request object is null

After all tries I print the phases(action,render,event) of the request using PortletActionContext.In that event phase is true.

My question:How can i get the request object in event phase and I just click on the navigation(/home) button why the request phase is event?

The purpose of getting the request objecct is to get the logged in person UserId.

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!