+ Start a Discussion
admin 7admin 7 

I am geeting this Error pls help me, i am posting my code also: Error: locationController Compile Error: unexpected token: 'locationList' at line 2 column 14 in controller

User-added image<apex:page controller="locationController"> 
Location Table <apex:messages style="color:red"></apex:messages>
 <apex:form>
 <apex:pageblock>
 <apex:pageblocktable value="{!locationList}" var="locItem"> 
 <apex:column headervalue="Country">
 <apex:inputfield value="{!locItem.Country__c}"> 
 </apex:inputfield> 
 </apex:column> 
 <apex:column headervalue="State/Province"> <apex:inputfield value="{!locItem.State__c}"> 
 </apex:inputfield>
 </apex:column> <apex:column headervalue="City">
 <apex:inputfield value="{!locItem.City__c}"> </apex:inputfield>
 </apex:column>
 </apex:pageblocktable> 
 </apex:pageblock> 
 </apex:form> 
 </apex:page> - 
 
 
 public with sharing class locationController {
 public list locationList{get;set;}
 public locationController() {
 locationList = [Select ID, Country__c, State__c, City__c From student__c];
 } 
 }
Malni Chandrasekaran 2Malni Chandrasekaran 2
Admin 7,
You have not defined what type of data that list (locationList) is supposed to hold.

Please try,
 public list<student__c>  locationList{get;set;}

Please mark it solved if it helps resolving your issue.

Thanks.
AKumAKum
Hi @admin7 : You have created a list without giving any type to that . As you are collecting records of type "student__c" then your list should also be a type of "student__c" .