Salesforce VisualForce中的嵌套表问题

Salesforce VisualForce中的嵌套表问题,salesforce,apex-code,visualforce,Salesforce,Apex Code,Visualforce,我在force.com apex模板的pageBlockSection中有一个表。在我尝试在我的一个单元格内使用outputText标记之前,这一切都很正常。使用此标记时,会向标记中添加额外的单元格和行。但是,如果我不将表嵌套在pageBlockSection标记内,则不会添加此类单元格 我是否错误地使用了outputText,或者force.com上是否存在错误 以下是重现此问题的最小标记: <apex:pageBlock title="My Page Block">

我在force.com apex模板的pageBlockSection中有一个表。在我尝试在我的一个单元格内使用outputText标记之前,这一切都很正常。使用此标记时,会向标记中添加额外的单元格和行。但是,如果我不将表嵌套在pageBlockSection标记内,则不会添加此类单元格

我是否错误地使用了outputText,或者force.com上是否存在错误

以下是重现此问题的最小标记:

<apex:pageBlock title="My Page Block">    
  <apex:pageBlockSection title="My Section">   
    <table>
      <tr><th>1</th><th>2</th></tr>
      <tr>
        <td>
          <apex:outputText value="{0}">
            <apex:param value="one" />
          </apex:outputText>
        </td>
        <td>
          <apex:outputText value="{0}">
            <apex:param value="two" />
          </apex:outputText>
        </td>
      </tr>
    </table>
  </apex:pageBlockSection>    
</apex:pageBlock>

12
以下是force.com提供的输出:

<table>
  <tbody>
    <tr><th>1</th><th>2</th></tr>
    <tr>
      <td></td>
      <td colspan="2" class="dataCol  first ">one</td>
    </tr>
    <tr>
      <td colspan="2" class="dataCol "></td>
      <td></td>
      <td colspan="2" class="dataCol ">two</td>
    </tr>
    <tr>
      <td colspan="2" class="dataCol  last "></td>
    </tr>
  </tbody>
</table>

12
一
二

我不能说这是否是一个bug,但我相信这是由
引起的,因为它们会自动将嵌套内容添加到表中,然后与您自己的表发生冲突

我建议删除
并将您的表直接放入
中,或者删除您自己的表并利用
元素:

<apex:pageBlock title="My Page Block">    
  <apex:pageBlockSection title="My Section">
    <apex:pageBlockSectionItem >
      1
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
      2
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
      <apex:outputText value="{0}">
        <apex:param value="one" />
      </apex:outputText>
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
      <apex:outputText value="{0}">
        <apex:param value="two" />
      </apex:outputText>
    </apex:pageBlockSectionItem>
  </apex:pageBlockSection>
</apex:pageBlock>

1.
2.

通过将表格放在outputPanel标签中,我可以绕过这个问题

<apex:pageBlockSection>
   <apex:outputPanel>
      <table>
      </table>
   </apex:outputPanel>
</apex:pageBlockSection>