Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-65861

I'm not sure on how to use actions; check this code



      Hi! I'm new to Liferay, and I'm a little confused on how it works. I'm having a really tough time understanding its structure (I don't usually do!).

      I'm just trying to make a simple portlet to scale out from that point and be able to program portlets, even if in a simple and archaic way (I don't really care; I just need this working in a few days). An important point to achieve this, is to be able to use actions.

      Check this code. I downloaded this example from a website, but it's not working for me (I use Liferay 6.2):

      <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
      User Name is : <b> ${userName}</b>
      <portlet:defineObjects />
      <portlet:actionURL name="addName" var="addNameUrl"></portlet:actionURL>
      <form action="${addNameUrl}" method="post">
      <input type="text" name="userName"><br>
      <input type="submit">

      This is my controller portlet:

      public class CustomMVCPortlet extends MVCPortlet {
      	public void addName(ActionRequest actionRequest,
      			ActionResponse actionResponse) throws IOException, PortletException, PortalException, SystemException{
      		String userName = ParamUtil.get(actionRequest, "userName", StringPool.BLANK);
      		actionRequest.setAttribute("userName", userName);

      This is supposed to work this way: you write a string in the input field, click on the submit button, and what you wrote should appear in the view as "User name is: whatYouWrote". But I don't see anything more than this:

      Somehow, actions are not working properly here. What change should I perform to get this working? Can anyone tell me in a simple way how these actions work?




            • Assignee:
              support-lep@liferay.com SE Support
              Zerok Pablo Vicente
              Recent user:
              Jason Pince
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:


                Version Package