CodesJava

Easy learning with example program codes

Jsf panelgrid html tag

JSF h:panelGrid tag is used to render HTML table element.

Attributes of h:panelGrid tag.

AttributeDescription
idid for the tag
bindingReference to the component used in a backing bean
renderedA boolean value; false would suppress rendering
styleClassCascading stylesheet (CSS) class name
valuevalue binding
bgcolorBackground color for the table
borderWidth of the table’s border
cellpaddingPadding around table cells
cellspacingSpacing between table cells
columnClassesComma-separated list of CSS classes for columns
columnsNumber of columns in the table
footerClassCSS class for the table footer
frameframe Specification for sides of the frame surrounding the table that are to be drawn; valid values: none, above, below, hsides, vsides, lhs, rhs, box, border
headerClassCSS class for the table header
rowClassesComma-separated list of CSS classes for columns
rulesSpecification for lines drawn between cells; valid values: groups, rows, columns, all
summarySummary of the table’s purpose and structure used for non-visual feedback such as speech
dirDirection for text. Valid values are ltr (left to right) and rtl (right to left).
langBase language of an element’s attributes and text
borderPixel value for an element’s border width
langBase language of an element’s attributes and text
titleA title used for accessibility. Browsers typically create tooltips for the title’s value
widthWidth of an element
onblurEvent handler for losing focus
onchangeEvent handler for value changes
onclickEvent handler for Mouse button clicked over the element
ondblclickEvent handler for Mouse button double-clicked
onfocusEvent handler for element received focus
onkeydownEvent handler for Key pressed
onkeypressEvent handler for Key pressed and released
onkeyupEvent handler for Key released
onmousedownEvent handler for Mouse button pressed
onmousemoveEvent handler for mouse moved
onmouseoutEvent handler for mouse left
onmouseoverEvent handler for mouse moved onto
onmouseupEvent handler for mouse button released

Example:

welcome.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<h:head>
		<title>JSF panel grid example.</title>
	</h:head>
<h:body>
	<h3>JSF panel grid example.</h3>
	<h:panelGrid id="panel" columns="2" border="1">
		<f:facet name="header">
			<h:outputText value="Login" />
		</f:facet>
		<h:outputLabel value="UserName" />
		<h:inputText />
		<h:outputLabel value="Password" />
		<h:inputSecret />
		<f:facet name="footer">
		  <h:panelGroup style="display:block;text-align:center">
			<h:commandButton id="submit" value="Submit" />
		  </h:panelGroup>
		</f:facet>
	</h:panelGrid>
</h:body>
 
</html>

faces-config.xml

<?xml version="1.0" encoding="windows-1252"?>
<faces-config version="2.0" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xi="http://www.w3.org/2001/XInclude" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
 
</faces-config>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 
    	xmlns="http://java.sun.com/xml/ns/javaee" 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    	http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
 
    <servlet>
        <servlet-name>faces</servlet-name>
        <servlet-class>
          javax.faces.webapp.FacesServlet
        </servlet-class>
    </servlet>
 
	<servlet-mapping>
        <servlet-name>faces</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
 
</web-app>

URL:

http://localhost:7001/JSFExample19/faces/welcome.xhtml

Output:

JSF example19-1
 
Download this example.
 

Please follow and like us:
error
Posted in JSF   








Copyright © 2019 CodesJava DMCA.com Protection Status