Lets try to understand this in this manner:
In simpler terms, Apex and Visualforce communication is all nothing but just the binding of variables. You don't need to do anything yourself. Just bind the variables and the values propagates from Visualforce to Apex.
Consider following example of Mass Edit:
APEX class:
public with sharing class myClass {
public myClass() {
dataRecords = [select Id,Name from myCustomObject__c];
}
//Getter & Setter here are important. This means you can GET records from this variable and ANY changes you do in VF page will get SET changed into this variable itself.
public list<myCustomObject__c> dataRecords { get;set; }
public void saveData() {
// this code below does not make anything for editing but you can certainly check if your changed values in input controls are carried onto this APEX call or not
integer i=0;
for (myCustomObject__c c : dataRecords) {
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, 'Row ['+i+']: ID = '+c.Id + ' | Name = '+c.Name));
i++;
}
// just call the update here and it means your records are saved with whatever data you modified in VF page Input Controls.
update dataRecords;
}
public void saveSingleRecord() {
string recId = ApexPages.currentpage().getParameters().get('myRecId');
myCustomObject__c mySingleRec;
for (myCustomObject__c c : dataRecords) {
if (recId == c.Id) {
mySingleRec = c;
break;
}
}
if (mySingleRec != null)
update mySingleRec;
}
}
Visualforce Page:
<apex:page controller="myClass">
<apex:form>
<apex:pageBlock title="My Data Records" id="thePageBlock">
<apex:pageMessages />
<apex:actionStatus id="loadingStatus" startText="Please Wait. Processing..." />
<apex:pageBlockButtons>
<apex:commandButton value="Save All Data" action="{!saveData}" rerender="thePageBlock" status="loadingStatus"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!dataRecords}" var="rec" id="myTable">
<apex:column headerValue="ID" value="{!rec.Id}" />
<apex:column headerValue="Name">
<apex:inputText value="{!rec.Name}" />
</apex:column>
<apex:column headerValue="Update">
<apex:commandLink action="{!saveSingleRecord}" rerender="thePageBlock" status="loadingStatus">
Update
<apex:param value="{!rec.id}" name="myRecId" />
</apex:commandLink>
</apex:column>
</apex:pageblocktable>
</apex:pageBlock>
</apex:form>
</apex:page>
The value for Name (which is binded to an inputText in the dataTable is auto passed to your class variables).
Important thing to understand here is this that, we have binded a list of data records to dataTable so that List Variable holds your changed values.
Direct test link: https://vcdev-developer-edition.ap1.force.com/sample/samplemassedit