It is sometimes required to pass some of the complex objects from ProcessAction() method to Render() method. The same can be easily achieved by passing the object using the below method:
We have add this in our Portlet.xml file
Changes in Portlet Class
actionRequest.SetRenderParameter(Object)
We have add this in our Portlet.xml file
<container-runtime-option>
<name>javax.portlet.actionScopedRequestAttributes</name>
<value>true</value>
<name>numberOfCachedScopes</name>
<value>10</value>
</container-runtime-option>
Changes in Portlet Class
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
if( request.getAttribute("EMPLOYEE_DETAILS") != null ) {
System.out.println("Not Null ");
} else {
System.out.println("Null");
}
}
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException {
Employee employee =new Employee();
request.setAttribute("EMPLOYEE_DETAILS", employee );
}
No comments:
Post a Comment