Q: Issue while passing the parameters from action class to view page in Liferay I have a view page where I have button to import the users from an excel sheet, So on click of import users button I am calling the following method in my portlet action class, Here I am iterating the list and calling the user creation method to create the users. Now I am able to create the users in the database. But I need to show which users are created and which users are not created in my status.jsp, I.e; After user creation I need to navigate to status page and display the which are created and which are not.
So I have declared two array lists globally and and added success user creation in one list and failed user list in another list as shown below, But I am getting error and not able to add to arraylist and not able to pass the arraylist to status page,
My action class,
  static ArrayList<String> successList;
    static ArrayList<String> failureList;

      public void addUser(ActionRequest request, ActionResponse response) 
                throws IOException, PortalException, SystemException {
    successList = new ArrayList<String>();
    failureList = new ArrayList<String>();
    while (iterator.hasNext()) {
     userCreation(themeDisplay, serviceContext, values.get(Field.Project_Name), values.get(Field.Project_Status), values.get(Field.Start_Date),
                            values.get(Field.End_Date), values.get(Field.Company_Name), values.get(Field.PM_FirstName), values.get(Field.PM_MiddleName),
                            values.get(Field.PM_LastName), values.get(Field.PM_Email), values.get(Field.PM_Password), values.get(Field.PM_Role), values.get(Field.PM_Status));

    }
      request.setAttribute("successList", successList);      request.setAttribute("failureList", failureList); response.setRenderParameter("mvcPath","/html/status.jsp");

    }
  public static void userCreation(ThemeDisplay themeDisplay, ServiceContext serviceContext,
                String Project_Name, String Project_Status, String Start_Date, String End_Date, String Company_Name,
                String FirstName, String MiddleName, String LastName, String Email, String Password,
                String Role, String Status) throws PortalException, SystemException
        {
     String result = null;
      try {
                    System.out.println("Try Bolck Start");

                    User newUser = UserLocalServiceUtil.addUser(creatorUserId, companyId, autoPassword, Password,
                            Password, autoScreenName, screenName, Email, facebookId, openId,
                            locale, FirstName, MiddleName, LastName, prefixId, suffixId, male,
                            birthdayMonth, birthdayDay, birthdayYear, role, groupIds,
                            organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);

                    long newUserID = newUser.getUserId();
        result = "The User "+ Email + " is created ";
                    successList.add(result);

            } catch(Exception e){

                    result = "The User "+ Email + " is not created ";
                    failureList.add(result);
            }   
    }

Status.jsp:
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<portlet:defineObjects />

<%
String success = (String)request.getAttribute("successList");
String failure = (String)request.getAttribute("failureList");
if(success!= null && !success.isEmpty())
{
    out.println("Following users are created successfully");
    out.println(success);   
    out.println();
}
if(failure!= null && !failure.isEmpty())
{
    out.println("Following users are not created ");
    out.println(failure);
    out.println();
}

%>

Also How can I send my list as list instead string, so that I can iterate the list in status.jsp and display in table format.
Thanks in advance

A: The two static lists in the portlet class can lead to contention problems when more than one users try to add users via this action.
A good suggestion is to redirect the user after the action is finished so that the action cannot be triggered again by refreshing the page.
Therefore, you cannot pass the two lists as a request attribute because the rendering that happens after the redirect will trigger a new request and therefore the attributes you have set are gone.
Liferay passes success and error messages from actions to the subsequent portlet rendering after a redirect by using the user session objects. I guess that using the session is a good option to pass your two lists to the rendering phase.
