2012-08-06 39 views
0

我正在使用Liferay 6和MVC portlet。我使用jsp和extjs来呈现我的portlet。当我最大化/最小化时,Portlet的当前状态会丢失。即使在最大化/最小化之后,我也想保留portlet的状态。我怎样才能做到这一点?最大化/最小化时不保留Portlet状态

感谢

回答

1

portlet有两个阶段:动作阶段&呈现阶段。当一些国家必须改变时,行动阶段将运行,例如。当表单提交完成时。在最大化/最小化之后,渲染阶段将始终运行。 如果您不想在渲染阶段更改某些状态,请将此逻辑置于操作阶段。

通过MVC的portlet必须处理每一个阶段两种方法:

public class MyLiferayTestPortlet extends MVCPortlet { 
    @Override 
    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { 
     System.out.println("action"); 
     //here you can change the state 
    } 

    @Override 
    public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { 
     System.out.println("rendering"); 
     //here you can prepaire the rendering of jsp 

     //print the window state 
     ThemeDisplay td = (ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY); 
     System.out.println("isStateMaximized: " + td.isStateMaximized()); 
    } 
} 

在这里,你可以阅读大约两个portlet的阶段: http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/understanding-the-two-phases-of-portlet-executi-4

+0

感谢您的帮助:) – user1415459 2012-08-14 15:39:10

相关问题