I see that the fields name , title , status and remarks all String (according to your comment ) so in the for loop you should use Object as String , and for this you do not need four ArrayList .
Here's what the line tag looks like:
<liferay-ui:search-container-row className="java.lang.Object" modelVar="search"> <%-- Since an "Object[]" is nothing but an "Object", we first cast the "search" instance to an "Object[]" and then to a "String" --%> <liferay-ui:search-container-column-text name='name' value='<%= (String) ((Object[])search)[0] %>' /> <liferay-ui:search-container-column-text name='title' value='<%= (String) ((Object[])search)[1] %>' /> <liferay-ui:search-container-column-text name='status' value='<%= (String) ((Object[])search)[2] %>' /> <liferay-ui:search-container-column-text name='remarks' value='<%= (String) ((Object[])search)[3] %>' /> </liferay-ui:search-container-row>
There you go, it should work.
A cleaner way, in my opinion, is to define a POJO that will store these values, and then you can return the POJO list. However, I have not tried the second approach.
Another standard approach is to include additional fields in any of the *Impl objects, and then return a list of this object, in your case, I assume that you have Student and Attendance objects, so you can status and remarks fields in StudentImpl , and then return List<Student> or put fname in AttendanceImpl and return List<Attendance> from the search method. (updated after this comment )
source share