20_JSP - CSI 3540 Structures techniques et normes du Web...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSI 3540 Structures, techniques et normes du Web Friday, March 26, 2010 Objectifs : 1. Concevoir des documents JSP 2. Se familiariser avec le langage d’expression (EL) et les JavaBeans Lectures : • Web Technologies (2007) § 8 Pages 447–463 Séparer la programmation de la présentation à l’aide de JSP Friday, March 26, 2010 Plan 1.Expression Language (EL) 2.JavaBeans et JSP 3.Bibliothèques de balises JSTL 4.MVC et JSP Friday, March 26, 2010 Introduction • Les documents JSP 2.0 (et +) sont des applications XML • Lors de la première visite (ou avant), le document est traduit en Java (Servlet) puis compilé, pour les prochaines visites, la forme compilée est utilisée Friday, March 26, 2010 Servlet correspondant au document JSP Document JSP Conteneur JSP Serveur Web Client Requête Requête Requête Réponse Réponse Réponse Traduction Friday, March 26, 2010 Introduction < html xmlns:core = "http://java.sun.com/jsp/jstl/core" xmlns:jsp = "http://java.sun.com/JSP/Page" xmlns = "http://www.w3.org/1999/xhtml" > < jsp : useBean id = "date" class = "java.util.Date" /> < head > < title >La date du jour</ title > </ head > < body style = "font-size:x-large" > < h2 >Voici la date du jour :</ h2 > < p > < core : out value = "${date}" /> </ p > </ body > </ html > Friday, March 26, 2010 Éléments JSP (3 types) • scriptage : permet l’insertion de code Java dans les documents JSP, par exemple <jsp:declaration> (variables d’instance ou de classe), <jsp:scriptlet> , <jsp:expression> • consignes : • <jsp:directive.page contentType=“...”/> • <jsp:directive.include fle=“Footer.jspF”/> Friday, March 26, 2010 <html ...> ... <body> <h1>Scriptlet</h1> <p> < jsp : declaration > String date = ( new java.util.Date() ).toString(); </ jsp : declaration > < jsp : scriptlet > out.write( date ); </ jsp : scriptlet > </p> <h1>Expression</h1> <p> < jsp : expression > d a t e </ jsp : expression > </p> </body> </html> Friday, March 26, 2010 Éléments JSP (3 types) • actions : • Prédéfnies (standard actions) • useBean, setProperty, getProperty, forward... • Défnies par l’usager, à l’aide des mécanismes de JSTL (JSP Standard Tag Library) Friday, March 26, 2010 Éléments JSP et les espaces de nommage < html xmlns:core = "http://java.sun.com/jsp/jstl/core" xmlns:jsp = "http://java.sun.com/JSP/Page" xmlns = "http://www.w3.org/1999/xhtml" > < jsp : useBean id = "date" class = "java.util.Date" /> .... </ html > < html xmlns:core = "http://java.sun.com/jsp/jstl/core" xmlns:page = "http://java.sun.com/JSP/Page" xmlns = "http://www.w3.org/1999/xhtml" > < page : useBean id = "date" class = "java.util.Date" /> .... </ html > Friday, March 26, 2010 Resources • Une ressource étonnamment brève et très utile • JavaServer Pages (JSP) v2.0 Syntax Reference [ http://java.sun.com/products/ jsp/syntax/2.0/syntaxref20.html ] 2008-03-05 • Référence complète (1126 pages) • http://java.sun.com/javaee/5/docs/ tutorial/doc/JavaEETutorial.pdf Friday, March 26, 2010 <html xmlns:core="http://java.sun.com/jsp/jstl/core"<html xmlns:core="http://java....
View Full Document

{[ snackBarMessage ]}

Page1 / 86

20_JSP - CSI 3540 Structures techniques et normes du Web...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online