title: Centering output text in a primefaces datatable column
body: <p>I have been scouring resources for a couple of hours trying to find a working solution to what I think is a simple problem: How to center output text in individual columns of a primefaces datatable?</p>
  
  <p>Everywhere I look says to surround the column with a <code>&lt;div&gt;</code> tag, which really seems odd and inefficient to me.  Lots of places say to use style="center", which doesn't work.  Even the example given at <a href="https://www.primefaces.org/showcase-ext/sections/exporter/columnAlignments.jsf" rel="nofollow noreferrer">primefaces.org extensions showcase</a> shows this doesn't work, where they have:</p>
  
  <pre><code> &lt;p:column filterBy="#{message.country}"&gt;  
        &lt;f:facet name="header"&gt;  
           &lt;h:outputText value="Country" /&gt;  
        &lt;/f:facet&gt;  
           &lt;h:outputText value="#{message.country}" style="center"/&gt;  
   &lt;/p:column&gt;  
  </code></pre>
  
  <p>Yet the data for country is aligned to the left.  </p>
  
  <p>In order to center the text in the column:</p>
  
  <pre><code>&lt;p:column headerText="Last Name"&gt;
      &lt;h:outputText value="#{item.lastName}" /&gt;
  &lt;/p:column&gt;
  </code></pre>
  
  <p>Is this:</p>
  
  <pre><code>&lt;p:column headerText="Last Name"&gt;
      &lt;div align="center"&gt;
          &lt;h:outputText value="#{item.lastName}" /&gt;
      &lt;/div&gt;
  &lt;/p:column&gt;
  </code></pre>
  
  <p>the only way?</p>