I have api objectfield name, how can I get the label?
Use $ObjectType global variable, and it could print the Student__c field label like this(please change the object name as needed)
<apex:outputLabel value="{!$ObjectType.CustomObject__c.fields.Student__c.Label}" />
Not sure if you can do it in pure visualforce. With Apex controller you'll be able to do something like this:
String objectName = 'Contact';
String fieldName = 'FirstName';
List<Schema.DescribeSObjectResult> describeSobjectsResult = Schema.describeSObjects(new List<String>{objectName}); // this can accept list of strings, we describe only one object here
System.debug(describeSobjectsResult);
String objectLabel = describeSobjectsResult[0].getLabel();
Map<String, Schema.SObjectField> allFields = describeSobjectsResult[0].fields.getMap();
System.debug(allFields);
String fieldLabel = allFields.get(fieldName).getDescribe().getLabel();
System.debug(objectName + '.' + fieldName + ' => ' + objectLabel + ', ' + fieldLabel);
Totally dynamic retrieval of object label & field label ;)
See http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_describe_objects_understanding.htm for more goodies.
Maybe it'd be possible in pure Visualforce with the ['string here']
syntax...
Also... exactly how dynamic you'll have to be? Check out the fieldsets in VF developer guide, might simplify your page greatly...
another simple way to display field label from apex, is like this (if the object and field is not to be dynamic) :
Schema.SObjectType.Contact.fields.Student__c.getLabel()
If it is to be displayed on vf, then you can use the following code :
<apex:outputText value="{!$ObjectType.Contact.fields.Student__c.Label}"/>