Facelets ui:insert ui:composition ui:define example


<!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:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<ui:insert name="pageCSS"><link href="../css/stylesheet.css" rel="stylesheet" type="text/css" /></ui:insert>
<title><ui:insert name="pageTitle">Acme Cargo CO.</ui:insert></title>
</head>
<body>

	<table id="mainTable" width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td align="center" valign="top">
			<table width="850" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="850" align="left" valign="top">
					<table width="850" border="0" cellpadding="0" cellspacing="0" class="header_table">
						<tr>
							<td align="left" valign="top"> </td>
						</tr>
						<tr>
							<td height="57" align="left" valign="middle" bgcolor="#FFFFFF"><!--<img src="../images/acme.bmp" alt="" width="218" height="44" class="logo" />--></td>
						</tr>
						<tr>
							<td align="left" valign="top" class="top_line"></td>
						</tr>
						<ui:insert name="pageLinks">
						
							<tr>
							<h:form>
								<td style="font-weight: bold;" align="right" class="top_menu_bg"><a
									href="#{facesContext.externalContext.requestContextPath}/pages/mainpage.jsf" class="menu_link">Home</a> | <a
									href="#{facesContext.externalContext.requestContextPath}/pages/admin/adminpanel.jsf" class="menu_link">People Related</a> |
									<a href="#{facesContext.externalContext.requestContextPath}/pages/admin/adminpanelcargo.jsf" class="menu_link">Cargo Related</a> |
									<h:commandLink value="Logout" action="#{AdminPanelBean.logOut}"></h:commandLink>
									</td>
							</h:form>
							</tr>
						
						</ui:insert>
						<tr>
							<td height="19" align="right" valign="top" class="bottom_menu_bg" style="white-space: pre; color: #FFF;">&nbsp;</td>
						</tr>
					</table>
					</td>
				</tr>
				<tr>
					<td align="left" valign="top">
					<table width="830" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="830" align="left" valign="top" class="body_box">
							<table width="830" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="830" align="left" valign="top">
								  <ui:insert name="note">Please fill all required (*)information to complete registration </ui:insert></td>
									<td width="10" align="left" valign="top"> </td>
								</tr>
								<tr>
									<td align="left" valign="top"><ui:insert name="pageBody">
									
										<table width="830" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="830" align="left" valign="top">
												<table width="830" border="0" cellspacing="0" cellpadding="0">
													<tr>
														<td align="left" valign="top"> </td>
														<td align="left" valign="top"> </td>
													</tr>
													<tr>
			
														<td valign="top">
														<h:form id="registerForm">
														<table width="80%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#666666">
															<tr>
																<td height="25" width="133">Firstname:</td>
																<td width="148">
																	<h:inputText id="firstname" class="input_box_enlarged" value="#{RegisterBean.firstname}" required="true">
																		<f:validateLength minimum="2" maximum="50" />
																	</h:inputText></td>
																<td width="312">* 
															  <h:message for="firstname" errorClass="errors" showDetail="false" showSummary="true"></h:message></td>
															</tr>
															<tr>
																<td height="25">Lastname:</td>
																<td>
																	<h:inputText id="lastname" class="input_box_enlarged" value="#{RegisterBean.lastname}" required="true">
																		<f:validateLength minimum="2" maximum="50" />
																	</h:inputText>
																</td>
																<td>*<h:message for="lastname" errorClass="errors" showDetail="false" showSummary="true"></h:message></td>
															</tr>
															<tr>
																<td height="25">Username:</td>
																<td>
																	<h:inputText id="username" class="input_box_enlarged" value="#{RegisterBean.username}" required="true">
																		<f:validateLength minimum="2" maximum="50" />
																	</h:inputText>
																</td>
																<td>* <h:message for="username" errorClass="errors"
																	showDetail="false" showSummary="true"></h:message></td>
															</tr>
															<tr>
																<td height="25">Password:</td>
																<td>
																	<h:inputSecret id="password" class="input_box_enlarged" value="#{RegisterBean.password}" required="true" redisplay="true">
																		<f:validateLength minimum="2" maximum="50" />
																	</h:inputSecret>
																</td>
																<td>*<h:message for="password" errorClass="errors" showDetail="false" showSummary="true"></h:message></td>
															</tr>
															<tr>
																<td height="25">Telephone:</td>
																<td>
																	<h:inputText id="telephone" class="input_box_enlarged" value="#{RegisterBean.telephonenumber}" required="true">
																		<f:validateLength minimum="2" maximum="50" />
																	</h:inputText>
																</td>
																<td>* <h:message for="telephone" errorClass="errors" showDetail="false" showSummary="true"></h:message></td>
															</tr>
															<tr>
																<td height="25">Secret question ?:</td>
																<td>
																	<h:inputText id="secretquestion" readonly="true" class="input_box_enlarged" value="#{RegisterBean.secretquestion}"></h:inputText></td>
																<td> </td>
															</tr>
															<tr>
																<td height="25">Secret answer:</td>
																<td>
																	<h:inputText id="secretanswer" class="input_box_enlarged" value="#{RegisterBean.secretanswer}" required="true">
																		<f:validateLength minimum="1" maximum="150" />
																	</h:inputText>
																</td>
																<td>*<h:message for="secretanswer" errorClass="errors" showDetail="false" showSummary="true"></h:message></td>
															</tr>
															<tr>
																<td height="25">Company Name:</td>
																<td>
																	<h:inputText id="companyname" class="input_box_enlarged" value="#{RegisterBean.company}" required="true">
																		<f:validateLength minimum="1" maximum="250" />
																	</h:inputText>
																</td>
																<td>*<h:message for="companyname" errorClass="errors" showDetail="false" showSummary="true"></h:message></td>
															</tr>
															<tr>
																<td height="25">Email:</td>
																<td>
																	<h:inputText id="email" class="input_box_enlarged" value="#{RegisterBean.email}" required="true">
																		<f:validateLength minimum="1" maximum="50" />
																	</h:inputText>
																</td>
																<td>*<h:message for="email" errorClass="errors" showDetail="false" showSummary="true"></h:message></td>
															</tr>
															<tr>
																<td colspan="3" align="center"><h:inputHidden id="hddn"/> <h:message for="hddn" style="color:red"/></td>
															</tr>
															<tr>
																<td align="right" colspan="3">
																<h:commandButton value="Send" action="#{RegisterBean.tryRegister}"></h:commandButton></td>
															</tr>
															
														
														</table>
														</h:form>
														</td>
														
													</tr>
													<tr>
														<td align="left" valign="top"> </td>
														<td style="text-align: justify;" align="left" valign="top"> </td>
														
													</tr>
													<tr>
														<td align="left" valign="top"> </td>
														<td align="left" valign="top"> </td>
													
													</tr>
												</table>
											  </td>
											</tr>
									  </table>
									</ui:insert>
									</td>
								</tr>
							</table>
						  </td>
						</tr>
					</table>
					</td>
				</tr>
				<tr>
					<td align="left" valign="top">				
					<table width="100%" border="0" cellpadding="0" cellspacing="0" class="footer_table">
						<tr>
							<td colspan="2" width="100%" align="center" valign="bottom">

								Copyright &copy; 2008 acmecargoco.com. All Rights Reserved.</td>
							
						</tr>
					</table>
					</td>
				</tr>
			</table>
			</td>
		</tr>
	</table>
</body>
</html>


<ui:composition template="/WEB-INF/xhtml/childtemplate.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html">
	
	<ui:define name="pageTitle">Insufficient Rights</ui:define>
	
	<ui:define name="note">
		<!-- empty -->
	</ui:define>
	
	<ui:define name="pageLinks">
		<tr>
			<td style="font-weight: bold;" align="right" class="top_menu_bg"><a
				href="mainpage.jsf" class="menu_link">Home</a></td>
		</tr>
	</ui:define>
	
	<ui:define name="pageBody"> 
	<center>
		<h3><b><h:graphicImage value="/images/error.gif"/>
		Insufficient Rights to see this page.</b></h3>
	</center>
	</ui:define>
	
</ui:composition>


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s