liferay中自定義欄位及部分路由說明
在liferay站點->站點設定->自定義欄位,中,對於這個儲存,首先,我們可以檢視form提交的action,
form中acion連線為:http://localhost:8082/group/control_panel/manage?
p_auth=heAqArRv&p_p_auth=6Z5Wds7k&p_p_id=165&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&
doAsGroupId=21413&refererPlid=20184&controlPanelCategory=sites&_165_struts_action=%2Fsite_settings%2Fedit_site
p_p_id=165為portlet的id為165。
引數165_struts_action=%2Fsite_settings%2Fedit_site,說明action為edit_site
在
在portal-web WEB-INF struts-config.xml 中
<action path="/admin_server/edit_site" type="com.liferay.portlet.sites.action.EditGroupAction">
<forward name="portlet.sites_admin.edit_site
<forward name="portlet.sites_admin.error" path="portlet.sites_admin.error" />
</action>
liferay-portlet.xml中
<portlet>
<portlet-name>165</portlet-name>
<icon>/html/icons/site_settings.png</icon>
<struts-path>site_settings
<parent-struts-path>sites_admin</parent-struts-path>
<portlet-url-class>com.liferay.portal.struts.StrutsActionPortletURL</portlet-url-class>
<control-panel-entry-category>site_administration.configuration</control-panel-entry-category>
<control-panel-entry-weight>1.0</control-panel-entry-weight>
<control-panel-entry-class>com.liferay.portlet.sitesadmin.SiteSettingsControlPanelEntry</control-panel-entry-class>
<preferences-owned-by-group>true</preferences-owned-by-group>
<use-default-template>false</use-default-template>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<render-weight>50</render-weight>
<header-portlet-css>/html/portlet/sites_admin/css/main.css</header-portlet-css>
<css-class-wrapper>portlet-site-settings</css-class-wrapper>
<add-default-resource>true</add-default-resource>
<system>true</system>
</portlet>
之後在tiles-defs.xml中查詢portlet.sites_admin.edit_site,找到
<definition name="portlet.sites_admin.edit_site" extends="portlet.sites_admin">
<put name="portlet_content" value="/portlet/sites_admin/edit_site.jsp" />
</definition>
接著在edit_site.jsp介面檢視所需的介面。
對於該介面,自定義欄位的查詢,一般為:
boolean showPrototypes = ParamUtil.getBoolean(request, "showPrototypes", true);
String[] mainSections = PropsValues.SITES_FORM_ADD_MAIN; //所需的jsp頁面的組合,在下面中有所體現
String[] seoSections = PropsValues.SITES_FORM_ADD_SEO;
String[] advancedSections = PropsValues.SITES_FORM_ADD_ADVANCED;
String[] miscellaneousSections = PropsValues.SITES_FORM_ADD_MISCELLANEOUS;
。。。。
。。。。
<liferay-ui:form-navigator
backURL="<%= backURL %>"
categoryNames="<%= _CATEGORY_NAMES %>"
categorySections="<%= categorySections %>" //展示mainSections中的內容資訊
jspPath="/html/portlet/sites_admin/site/"
showButtons="<%= true %>"
/>
</aui:form>
在liferay-ui.tld中
<tag>
<name>form-navigator</name>
<tag-class>com.liferay.taglib.ui.FormNavigatorTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>backURL</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>categoryNames</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>categorySections</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>displayStyle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>formName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>htmlBottom</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>htmlTop</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>jspPath</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>showButtons</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
在com.liferay.taglib.ui.FormNavigatorTag類中跳轉頁面為:
private static final String _PAGE =
"/html/taglib/ui/form_navigator/page.jsp";
在portal.properties中檢視
sites.form.add.main=details,categorization //為details.jsp和categorization .jsp ,為
sites.form.add.seo=
sites.form.add.advanced=
sites.form.add.miscellaneous=
之後頁面進行組合即可。