title: Passing values to action class from radio button
body: <p>I am having a jsp form where I have to mark attendance for each employee and store the results in the database. My jsp snippet for marking attendance is as follows:</p>
  
  <pre><code>&lt;portlet:defineObjects /&gt;
  &lt;%
     List&lt;Employee&gt; EmployeeAttendanceDetails = MISPortalActionUtil.getEmployeeData();
   %&gt;
  
  
  
   &lt;portlet:renderURL  var="viewMarkAttendanceURL"/&gt;
   &lt;!DOCTYPE HTML&gt;
   &lt;html&gt;
    &lt;head&gt;
     &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;title&gt;mark attendance&lt;/title&gt;
   &lt;/head&gt;
  
   &lt;body&gt;
  Mark Attendance for Today:   
  &lt;%= new java.util.Date() %&gt;
  &lt;portlet:actionURL name="updateDailyAttendance" var="updateDailyAttendanceURL" /&gt;
  
  
  **&lt;aui:form name="updateDailyAttendance" action="&lt;%=updateDailyAttendanceURL.toString()%&gt;" method="post" &gt;
  &lt;portlet:renderURL var="viewEmployeeDataURL"/&gt;
  &lt;liferay-ui:search-container delta="20" emptyResultsMessage="No Results Found"&gt;
  &lt;liferay-ui:search-container-results total="&lt;%= EmployeeAttendanceDetails .size() %&gt;"
  results="&lt;%= ListUtil.subList(EmployeeAttendanceDetails , searchContainer.getStart(),     searchContainer.getEnd()) %&gt;" /&gt;
  &lt;liferay-ui:search-container-row modelVar="search"
   className="com.test.mis.portal.model.Employee"&gt;
  &lt;liferay-ui:search-container-column-text name='Employee Name'     value='&lt;%=String.valueOf(search.getEmpFname()) + " " +    String.valueOf(search.getEmpLname())%&gt;' href="" /&gt;
  &lt;liferay-ui:search-container-column-text name='Employee Id' value='&lt;%=String.valueOf(search.getEmpId())%&gt;' href="" /&gt;
  &lt;liferay-ui:search-container-column-text name = "Attendance Status" &gt;
   &lt;label&gt;Present&lt;/label&gt;&lt;input type = "radio" name ='updateattendance +     &lt;%=String.valueOf(search.getEmpId())%&gt;' value = "present" /&gt;
  &lt;label&gt;Absent&lt;/label&gt;&lt;input type = "radio" name= 'updateattendance +     &lt;%=String.valueOf(search.getEmpId())%&gt;' value = "absent"/&gt;
  &lt;/liferay-ui:search-container-column-text&gt;
  &lt;/liferay-ui:search-container-row&gt;
  &lt;liferay-ui:search-iterator searchContainer="&lt;%=searchContainer %&gt;" paginate="&lt;%=true %&gt;" /&gt;
  &lt;/liferay-ui:search-container&gt; 
  &lt;input type = "submit" value = "Update"/&gt;
  &lt;/aui:form&gt;**
  </code></pre>
  
  <p>And I use the following functions to mark the attendance:
  public void updateDailyAttendance(ActionRequest areq, ActionResponse aRes) throws Exception{</p>
  
  <pre><code>int totalEmployees = EmployeeLocalServiceUtil.getEmployeesCount();
  String attendanceValue = getAttendanceValue(areq);
  ***for (int i = 0; i &lt; totalEmployees; i++) {
  long attPKey = CounterLocalServiceUtil.increment(Employee.class.getName());
  Attendance newAttendanceInstance = new AttendanceImpl();
  newAttendanceInstance.setAttId(attPKey);
  newAttendanceInstance.setAttStatus(attendanceValue);
  AttendanceLocalServiceUtil.addAttendance(newAttendanceInstance);
  }***
  }
  
   private String getAttendanceValue(ActionRequest areq) {
   Enumeration parameters = areq.getParameterNames();
  
   while (parameters.hasMoreElements()) {
   String parameterName = parameters.nextElement().toString();
   if (parameterName.startsWith("updateattendance")) {
   return areq.getParameter(parameterName);
  }
  }
  throw new IllegalStateException("Parameter updateattendance is not found");
  }
  </code></pre>
  
  <p>The problem that I am facing is that whatever attendance I mark for the first employee (Present/Absent) the same is stored for the other employees. The error I think is in the above for loop which I have italicized. How should I rectify this code such that for each employee the correct attendance status is stored?</p>