Liferay6 开发 环境部署 Liferay6实例(7)

2019-04-22 21:53

Liferay 6 Development Documentation

portletConfig.getPortletName(), themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); } } portletURL.setWindowState(WindowState.MAXIMIZED); portletURL.setParameter(\portletURL.setParameter(\portletURL.setParameter(\return portletURL.toString(); 17. Update struts-config-ext.xml

File path: /myliferay-ext/docroot/WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml

struts-config

PUBLIC

\

Software

Foundation//DTD

Struts

Configuration

1.2//EN\

\

18. Add ProductDeleteAction.java

File path:

/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/ProductDeleteAction.java

/** * */ Liferay 6 Development Documentation

package com.accentrix.ecatalog.product.action;

import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletConfig; import javax.portlet.PortletRequest; import javax.portlet.WindowState;

import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping;

import com.accentrix.ecatalog.product.service.ProductLocalServiceUtil; import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.StringUtil; import com.liferay.portal.struts.PortletAction; import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.WebKeys; import com.liferay.portlet.ActionRequestImpl; import com.liferay.portlet.PortletURLImpl; /**

* @author tom.wu * */

public class ProductDeleteAction extends PortletAction {

@Override

public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest

actionRequest, ActionResponse actionResponse) throws Exception {

protected String getRedirctURL(PortletConfig portletConfig, ActionRequest actionRequest) throws Exception {

ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletURLImpl

portletURL

=

new

PortletURLImpl((ActionRequestImpl)

actionRequest,

}

String[] productUuids = StringUtil.split(ParamUtil.getString(actionRequest, \if (productUuids != null) { }

String url = this.getRedirctURL(portletConfig, actionRequest); super.sendRedirect(actionRequest, actionResponse, url);

for (int i = 0; i < productUuids.length; i++) { }

ProductLocalServiceUtil.deleteProduct(productUuids[i]);

portletConfig.getPortletName(), themeDisplay.getPlid(), PortletRequest.RENDER_PHASE);

portletURL.setWindowState(WindowState.MAXIMIZED);

portletURL.setParameter(\

Liferay 6 Development Documentation

} } return portletURL.toString();

19. Update products.jsp

a) b) c)

Add “Delete” button

Add checkbox for each search result Add JavaScript for checkbox

File path: /myliferay-ext/docroot/WEB-INF/ext-web/docroot/html/portlet/product/products.jsp

<%@ include file=\

<%@taglib uri=\

<%@ page import=\<%@ page import=\<%

ProductSearch searchContainer = (ProductSearch) request.getAttribute(\ searchContainer.setRowChecker(new RowChecker(renderResponse)); //add checkbox to each row String name = ParamUtil.getString(request, \%>

action=\

searchURL

%>\

method=\

name=\

onSubmit='<%=

renderResponse.getNamespace() + \

themeDisplay.getPathThemeImages() + \

' type=\

value='<%= LanguageUtil.format(pageContext, \

type=\

value=\

Liferay 6 Development Documentation

function addProduct() { document.

/>productForm.action=\

name=\

value=\

windowState=\

currentURL %>\

function search() {

document.productForm.submit(); }

document.productForm.submit();

Liferay.provide(

window,

'deleteProduct', function() {

if

(confirm('<%=

UnicodeLanguageUtil.get(pageContext,

}

\

document.productForm.productUuids.value =

Liferay.Util.listCheckedExcept(document.productForm, \

);

},

['liferay-util-list-fields']

submitForm(document.productForm, \

\}

20. Update struts-config-ext.xml

File path: /myliferay-ext/docroot/WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml

Liferay 6 Development Documentation

path=\

type=\

scope=\

name=\

name=\

name=\

6. FAQ(Frequent Asked Questions)

1. [Question] How to deploy Liferay on different container such as JBoss?

[Answer] According the admin document, Liferay could be deploy to JBoss. Page 37 in

2. [Question] How to configure Liferay to use non-embedded


Liferay6 开发 环境部署 Liferay6实例(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:岗位手册-制单员(展厅)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: