Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JSF column Tag 
 

This section tells you about the JSF html column tag which is used for creating columns of a table. This tag creates a data column inside a data table.

 

JSF column Tag

                          

This section tells you about the JSF html column tag which is used for creating columns of a table. This tag creates a data column inside a data table. By this table you can specify number of column and fix these with some specific values. You can specify the value for specific column by using data array. JSF data table creates multiple rows up to the length of array or number of elements associated with the data table.

This section provides you a complete code of a program in which the column tags are used inside the data table. This program will help you for the procedure of using column tag for creating columns in a table.

Code Description:

<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<f:view>
<html>
     <head><title>jsf h:column example</title></head>

     <body>
          <h:dataTable border="1">
          <f:facet name="header">
              <h:outputText value="This is header."/>
          </f:facet>
          <h:column>
              <f:facet name="header">
                   <h:outputText value="Student"/>
              </f:facet>
          </h:column>
          <h:column>
              <f:facet name="header">
                   <h:outputText value="Marks" />
              </f:facet>
          </h:column>
          <h:column>
              <f:facet name="header">
                   <h:outputText value="Percent" />
              </f:facet>
          </h:column>
          <f:facet name="footer">
               <h:outputText value="This is footer."/>
          </f:facet>
          </h:dataTable>
     </body>
</html>
</f:view>

Rendered Output:

HTML Source Code:

<html>
     <head><title>jsf h:column example</title></head>

     <body>
	  <table border="1">
          <thead>
                <tr><th colspan="3" scope="colgroup">This is header.</th></tr>
                <tr>
                    <th scope="col">Student</th>
                    <th scope="col">Marks</th>
                    <th scope="col">Percent</th>
                </tr>
          </thead>
          <tfoot>
                <tr><td colspan="3">This is footer.</td></tr>
          </tfoot>
          <tbody>
          </tbody>
          </table>
     </body>
</html>

JSF column tag has some attribute for different purposes. These attributes are explained below:

  • rendered: This is an attribute of the column tag that is optional. This attribute can hold String typed value. This attribute value indicates that the component should be rendered during the rendering period.
  • binding: This attribute is also optional and take a String typed value. Specified value is linked with the backing bean through the attribute of the tag.
  • id: This attribute of the column tag is specified only for identification of the specific tag.

                          

» View all related tutorials
Related Tags: c com memory server dynamic tree components core component tag name this node oo ibm create root like for example

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

7 comments so far (
post your own) View All Comments Latest 10 Comments:

In every example try to give faces.config.xml file also..It will be very helpful also.It will solve all of the doubts of readers.

Posted by GURUPRASAD on Wednesday, 10.29.08 @ 17:54pm | #81395

hi can we create the data-table dynamically in jsf

Posted by jai on Friday, 01.11.08 @ 18:35pm | #44988

hi every body how ru today?

Posted by bijay on Thursday, 12.20.07 @ 11:37am | #43078

You can use a
<h:panelGrid columns="3">
<h:column>
<f:facet name="header">
<h:outputText value="Student"/>
</f:facet>
<h:outputText value="#{item.stname}" />
</h:column>
</h:panelGrid>

It means that you show 3 values each column, when you show the third, it is at next row

Posted by Mario on Thursday, 11.15.07 @ 21:27pm | #37515

Hi,
My problem is Create the data and Retreve the data from data base in the table row's and column's plz help me
Thanks,
vinay

Posted by vinay on Thursday, 06.14.07 @ 12:51pm | #19189

Hi balan,
Hence, datatable is used for the retrieving value dynamically. So, You can use the following code for getting values from the Bean class for the the specified column i.e. mentioned inside the facet tag.

<h:column>
<f:facet name="header">
<h:outputText value="Student"/>
</f:facet>
<h:outputText value="#{item.stname}" />
</h:column>

This code will automatically generate multiple rows for the values of the stname variable is of the bean class.

Thanks & Regards
Chandan Kumar Verma
Roseindia Member

Posted by chandan on Tuesday, 06.5.07 @ 12:36pm | #18265

Hi ,

How can we create a new rows using <h:datatable> .

Please help me out.

Rgds,
balan

Posted by balan on Saturday, 06.2.07 @ 20:19pm | #18037

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.