Thank you so much for reply.I was using bean only not controller.
I have tried <repeat> and <foreach> both tags none of them worked. My requirement is to update entire records (all column field) of the table, so i retrieved complete records assign to Inputtext for editing the value.
As i mentioned its an n rows x n columns. My code has mentioned below, i'm sure it's incorrect logic. Please let me know if you see any logic for this specific requirement.
Ist forech represents row count.
2nd foreach represents columns value for all the record.
Say I have table having 3 columns and 2 records on it .
Bean Code:
public String retrieve() {
parentlist=new ArrayList<Integer>();
parentlist.add(1); //Row 1
parentlist.add(2); //Row 2
list = new ArrayList<Integer>();
list.add(0,1); //Column 1 value of Row1
list.add(1,2); //Column 2 value of Row1
list.add(2,3); //Column 3 value of Row1
list.add(3,4); //Column 1 value of Row2
list.add(4,5); //Column 2 value of Row2
list.add(5,6);//Column 3 value of Row2
}
//This is will return column value based index
public List<Integer> getList() {
return list;
}
//Submit
public String processRequest() {
try {
System.out.println("***********User Saved data*****************" + list);//list
} catch (Exception anException) {
}
return "";
}
JSF code
<c:forEach items="#{backedbean.parentlist}"
var="prntstationCodeString" varStatus="prentrowCounter"
id="parentloop">
<h:outputLabel style="text-valign:middle;"
value="#{counter}"
escape="false" />
<c:forEach items="#{backedbean.list}"
var="CodeString" varStatus="rowCounter" id="loop">
<c:if test="#{rowCounter.index lt 2}"> //Since total column is 3 so it loop through up to 2
<h:inputText
value="#{bean.list[counter]}" /> // getList() will be called.
</c:if>
<c:set var="counter" value="${counter + 1}" />
</c:forEach>
</c:forEach>