我在liferay中创建了一个portlet(这是我的第一个portlet).在那我已经遵循了liferay的mvc结构.它的Java文件如下: -
package com.liferay.samples;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletPreferences;
//import javax.portlet.GenericPortlet;
import com.liferay.util.bridges.mvc.MVCPortlet;
public class MyGreetingPortlet extends MVCPortlet {
@Override
public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
PortletPreferences prefs = actionRequest.getPreferences();
String greetingname = actionRequest.getParameter("greetingname");
String greeting = actionRequest.getParameter("greeting");
if (greeting != null && greetingname != null)
{
prefs.setValue(greetingname, greeting);
prefs.store();
}
//System.out.println("In doView code");
super.processAction(actionRequest, actionResponse);
}
public void fetchdataAction( ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
System.out.println("In doView …Run Code Online (Sandbox Code Playgroud)