+ Start a Discussion
PeacePeace 

Values returned from a List should be displayed one per output textbox

Hi.

 

I am new to salesforce.  Please can anyone help me in following issue.

 

My VF page Reads a CSV file and displays its field names on clicking command button

 

 <apex:inputFile value="{!contentFile}" filename="{!nameFile}" />

 <apex:commandButton action="{!ReadFile}" value="Next" id="theButton">

 

Controller:

public string nameFile{get;set;}
 public Blob contentFile{get;set;}
 String[] filelines = new String[]{};
 String[] HeaderXLS = new String[]{};

 public Pagereference ReadFile()
    {
     

        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
       
    
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
             HeaderXLS = filelines[0].split(',');
               length = HeaderXLS.size();
         }      
               for(Integer j=0;j<HeaderXLS.size();j++)
               {
                options.add(HeaderXLS[j]);
                
               }
 PageReference page2 = new PageReference('/apex/Mapping'); <!-- Mapping is the page on which field names are displayed -->
     
     page2.setRedirect(false);
      return page2;
    }

 

 It displays all the field names in a single row.   i want it to display one field name per row.

 

Mapping page:

<apex:repeat value="{!list}" rows="{!Number}" var="c">
                                                       
 <apex:outputText value=" {0} ">
       <apex:param value="{!Header}"/>
        </apex:outputText>
</apex:repeat>

 Number of Rows are equal to the number of Fields

 

Best Answer chosen by Admin (Salesforce Developers) 
PeacePeace

Well,  the solution is :

 <apex:param value="{!Header[c]}"/>