This is the code to create new portlet in Liferay 7 / Liferay DXP .
init.jsp
1
2
3
4
5
6
7
8
9
10
11
12
| <liferay-theme:defineObjects /><portlet:defineObjects /> |
view.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
| <%@ include file="/init.jsp"%><portlet:actionURL name="autoDetailsSubmit" var="autoDetailsSubmit" /><aui:form action="<%=autoDetailsSubmit%>" method="post"name="autoDetailsSubmit"> <!-- MANUFACTURER --> <aui:fieldset> <aui:select label="Manufacturer" name="manufacturer"> <aui:option label="AUDI" /> <aui:option label="BMW" /> <aui:option label="GM" /> <aui:option label="VOLVO" /> <aui:option label="TATA" /> </aui:select> </aui:fieldset> <!-- YEAR --> <aui:fieldset> <aui:select label="Year Of Manufactoring" name="year"> <aui:option label="2011" /> <aui:option label="2012" /> <aui:option label="2013" /> <aui:option label="2014" /> <aui:option label="2015" /> </aui:select> </aui:fieldset> <aui:input name="vin" label="VIN" /> <aui:input name="bodystyle" label="Bodystyle" /> <aui:input name="model" label="Model" /> <aui:button class="btn btn-success" name="Submit" type="submit" /></aui:form> |
AutoDetailsPortlet.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| package com.autodetails.portlet;import java.io.IOException;import javax.portlet.ActionRequest;import javax.portlet.ActionResponse;import javax.portlet.Portlet;import javax.portlet.PortletException;import javax.portlet.ProcessAction;import org.osgi.service.component.annotations.Component;import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;import com.liferay.portal.kernel.util.ParamUtil;@Component(immediate = true, property = { "com.liferay.portlet.display-category=category.sample", "com.liferay.portlet.instanceable=true", "javax.portlet.display-name=AutoDetails Portlet", "javax.portlet.init-param.template-path=/", "javax.portlet.init-param.view-template=/view.jsp", "javax.portlet.resource-bundle=content.Language", "javax.portlet.security-role-ref=power-user,user" }, service = Portlet.class)public class AutoDetailsPortlet extends MVCPortlet { @ProcessAction(name = "autoDetailsSubmit") public void autoDetailsSubmit(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { System.out.println(">>>>>>>>>>>>>>>>>>>>>Into autoDetailsSubmit"); ParamUtil.print(actionRequest); }} |
Download Sourcecode :




0 comments:
Post a Comment