Hi i try do portlet from liferay documentation. But my java class dont work.
MyGreetingPortlet
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 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 greeting = actionRequest.getParameter("greeting");
if (greeting != null) {
prefs.setValue("greeting", greeting);
prefs.store();
}
super.processAction(actionRequest, actionResponse);
}
}
view.jsp
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ page import="javax.portlet.PortletPreferences" %>
<portlet:defineObjects />
<% PortletPreferences prefs = renderRequest.getPreferences();
String greeting = (String)prefs.getValue( "greeting", "Hello! Welcome to our portal."); %>
<p><%= greeting %></p>
<portlet:renderURL var="editGreetingURL"> <portlet:param name="jspPage" value="/edit.jsp" />
</portlet:renderURL>
<p><a href="<%= editGreetingURL %>">Edit greeting</a></p>
edit.jsp
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@ page import="com.liferay.portal.kernel.util.Validator" %>
<%@ page import="javax.portlet.PortletPreferences" %>
<portlet:defineObjects />
<% PortletPreferences prefs = renderRequest.getPreferences();
String greeting = (String)prefs.getValue( "greeting", "Hello! Welcome to our portal."); %>
<portlet:actionURL var="editGreetingURL"> <portlet:param name="jspPage" value="/edit.jsp" />
</portlet:actionURL>
<form action="<%= editGreetingURL %>" method="post">
<label><input type="text"><%= greeting %></label>
<input type="submit" name="submit" value="Submit">
</form>
<portlet:renderURL var="viewGreetingURL">
<portlet:param name="jspPage" value="/view.jsp" />
</portlet:renderURL>
<p><a href="<%= viewGreetingURL %>">← Back</a></p>
After deploy jsp works fine, but when i click on Submit button nothing heppens. I change only one thing in this example: delete aui tags but dont think that chage something, couse im already try a few diffetent examples and no one works with java classes. Oh, and i use MVC portlets.