在portlet-ext.xml里面
<portlet>
<portlet-name>EXT_Users</portlet-name>
<display-name>Users</display-name>
<portlet-class>com.ext.portlet.users.UsersPortlet</portlet-class>
<init-param>
<name>edit-action</name>
<value>/ext/users/new_users</value>
</init-param>
<init-param>
<name>edit-guest-action</name>
<value>/ext/users/new_users</value>
</init-param>
<init-param>
<name>view-action</name>
<value>/ext/users/new_users</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>edit</portlet-mode>
<portlet-mode>edit_guest</portlet-mode>
</supports>
<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
<portlet-preferences>
<preference>
<name>test</name>
<value>456</value>
</preference>
</portlet-preferences>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
其中多配置几个<init-param>,edit-action对应着deEdit
再在UsersPortlet类里面加入deEdit方法
public void doEdit(RenderRequest renderRequest,
RenderResponse renderResponse) throws IOException, PortletException {
PortletPreferences prefs = renderRequest.getPreferences();
System.out.println("UsersPortlet doEdit===>"+prefs.getValue("test", ""));
super.doEdit(renderRequest, renderResponse);
}
这样之后,就可以在页面的portlet里面
图表 1
点击 按钮,就出来首选项,点击进去之后就是我们写的这个deEdit,它会调用doEdit方法
也可以在角色 配置权限里面的portlet里面进行配置
<portlet>
<portlet-name>EXT_Users</portlet-name>
<display-name>Users</display-name>
<portlet-class>com.ext.portlet.users.UsersPortlet</portlet-class>
<init-param>
<name>edit-action</name>
<value>/ext/users/new_users</value>
</init-param>
<init-param>
<name>edit-guest-action</name>
<value>/ext/users/new_users</value>
</init-param>
<init-param>
<name>view-action</name>
<value>/ext/users/new_users</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>edit</portlet-mode>
<portlet-mode>edit_guest</portlet-mode>
</supports>
<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
<portlet-preferences>
<preference>
<name>test</name>
<value>456</value>
</preference>
</portlet-preferences>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
其中多配置几个<init-param>,edit-action对应着deEdit
再在UsersPortlet类里面加入deEdit方法
public void doEdit(RenderRequest renderRequest,
RenderResponse renderResponse) throws IOException, PortletException {
PortletPreferences prefs = renderRequest.getPreferences();
System.out.println("UsersPortlet doEdit===>"+prefs.getValue("test", ""));
super.doEdit(renderRequest, renderResponse);
}
这样之后,就可以在页面的portlet里面
图表 1
点击 按钮,就出来首选项,点击进去之后就是我们写的这个deEdit,它会调用doEdit方法
也可以在角色 配置权限里面的portlet里面进行配置