SlideServe
Menu
Préférences
© SlideServe · v2026

IS-907 Java EE

nrandall avatar
6 diapositives · 107 Views · Dec 19, 2019

Learn how to avoid code duplication and define common page structures using templates in Java EE templating. Templates can include default contents for each part and are referenced in Facelets, allowing for organized and reusable web pages.

IS-907 Java EE - slide 1
01 / 6IS-907 Java EE
1 / 17

Télécharger la présentation

IS-907 Java EE
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. IS-907 Java EE Templating

  2. Templates • When an application contains several pages with similar structure, duplication of code can be avoided through the use of templates • The template defines the structure of the page with named parts • The template may specify default content for each part • Facelets which use the template must specify the named parts • Default content is used for unspecified parts Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon

  3. Defining templates • The template is an ordinary facelet, except ui:insert tags are used to specify replacable parts: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <title><ui:insert name="title" /></title> <h:outputStylesheet library="css" name="is907.css" /> </h:head> <h:body> <div id="heading" class="heading"> <ui:insert name="heading”/> </div> ... Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon

  4. Defining default content • The ui:include tag is used to include default content from other files: <div id="sidebar" class="menu"> <ui:insert name="sidebar"> <ui:include src="/views/common/sidebar.xhtml" /> </ui:insert> </div> Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon

  5. Using templates <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <title>IGNORED</title> </h:head> <h:body> <ui:composition template="/views/templates/layout.xhtml"> <ui:define name="title">IS-907 Netshop - Price List</ui:define> <ui:define name="content"> <h1>Price List</h1> ... </ui:define> </ui:composition> Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon

  6. Using templates • Facelets refer to templates with a ui:composition tag • and specify the parts with ui:define tags • Only the contents of the ui:composition tag are used • the rest of the file is ignored • the structure of the page is taken from the template • Included files (e.g. default parts) are treated the same way: • Only the contents of the ui:composition tag are used Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon