[SalesForce] How to display results of class method on visual force page

I have an apex class that contains a method that generates a list of objects. I want to display this list of objects on a visual force page in order to test the data that the method is generating. In order to make the list available to the page, I created another method in the class that has a return type of pageReference:

 public pageReference createCampaignFromPage(){
          campaignMembersRet = addCampaignMembers();
          return null;
        } 

This method calls the method addCampaignMembers() which returns the list in question. The return value of addCampaignMembers() is stored in public List<CampaignMember> campaignMembersRet {get; set;} which is made publicly available for the visualforce page to use.

Inside of the visualforce page, I have the code:

<apex:page controller="CreateCampaign"   >
<apex:form >
     <apex:pageBlock title="Quick Edit: ">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!createCampaignFromPage}" value="Save"/>
        </apex:pageBlockButtons>
         </apex:pageBlock>
        <h1>Hello World</h1> 

    <apex:outputText value="{!testvar}" id="theValue"/><br/>
    <apex:repeat value="{!campaignMembersRet}" var="string" id="theRepeat2"> //It appears that this loop isn't being entered.
        <apex:outputText value="{!string}" id="theValue3"/><br/>
    </apex:repeat>

</apex:form>

This should print out attributes of the List of objects iteratively when the button is pressed, but instead, the markup for the page is displayed without the data. There are two errors in the dev console including one regarding the logo for the page not being displayed and the other being Invalid 'X-Frame-Options' header encountered when loading. I'm not sure if this would be the issue causing the text to not appear in the loop.

What could be causing the problem? Is there anything here that stands out as being incorrect?

EDIT: Image of preview from dev console

enter image description here

Best Answer

I am posting this as an answer because I believe this is the underlying issue based upon your screenshots and comments.

You appear to be trying to iterate over something that's not a collection (a single CampaignMember) by including an <apex:dataList> inside an <apex:repeat>. Remove the data list entirely, and use the repeat element to iterate over your list of CampaignMembers to display attributes of each one.

Additionall, you can't call Apex (System.debug) inline in Visualforce. You may use Visualforce merge tags ({! }) in the page body (i.e., not within a tag).