[SalesForce] Want to create select option from Apex

I am trying to create a table from apex according to the no of rows and columns entered on the Vf page the apex code will generate a table. This much is working fine. Now i need to add a select option in every columns. I wrote the code for it but the table is getting generated not the select option, is it possible to create select option from apex. please guide me.
My code

    createtable = '<table border="1" size="width:100">';

    for(integer i =1; i<= No_Row; i++){// Looping through row
         createtable = createtable + '<tr>';
        for(integer j=1; j<= No_column ; j++){// Looping through column
            createtable = createtable + '<td><apex:selectList value="{!getSelected}" ><apex:selectOptions value="{!items}" /></apex:selectList></td>';
        }
        createtable = createtable + '</tr>';
    }

    createtable = createtable +'</table>';
    system.debug('table view '+ createtable );

debug log:

<table border="1" size="width:100"><tr><td><apex:selectList value="{!getSelected}" >   <apex:selectOptions value="{!items}" /></apex:selectList></td></tr></table>

Best Answer

If it really must be so crazy... :)

Controller:

public String createtable { get; set; }
public Integer No_Row { get; set; }
public Integer No_column { get; set; }
public String getSelected { get; set; }

public List<SelectOption> getItems() {
    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('1','Value 1'));
    options.add(new SelectOption('2','Value 2'));
    return options;
}

public PageReference createTable()
{
    createtable = '<table border="1" size="width:100">';

    for(integer i =1; i<= No_Row; i++){
        createtable = createtable + '<tr>';

        for(integer j=1; j<= No_column ; j++){
            createtable += '<td>';
            createtable += '<select onchange="takeValue(this.options[this.selectedIndex].value);">';
            for(SelectOption option : getItems())
            {
                createtable += '<option value="' + option.getValue() + '">' + option.getLabel() + '</option>';
            }
            createtable += '</select>';
        }
        createtable = createtable + '</tr>';
    }

    createtable = createtable +'</table>';

    return null;
}

Page:

<apex:page controller="test1" action="{!createTable}">

<apex:form>

    You have selected: <apex:outputText value="{!getSelected}" id="output"/>

    <apex:actionFunction name="takeValue" reRender="output">
        <apex:param name="p1" assignTo="{!getSelected}" value=""/>
    </apex:actionFunction>

    <apex:outputText value="{!createtable}" escape="false" id="table"/>

    <br/><br/>

    Rows: <apex:inputText value="{!No_Row}" style="width:20px;"/>
    Cols: <apex:inputText value="{!No_column}" style="width:20px;"/>

    <apex:commandButton action="{!createTable}" reRender="table" value="Ok"/>

</apex:form>

</apex:page>

And the result:

enter image description here