Taglibs et JSTL
5
M.Romdhani, INSAT, Mars 2009
Fig. 10.30 JSP
1 <?xml version = "1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5 <!-- Fig. 10.30: customTagWelcome.jsp -->
6 <!-- JSP that uses a custom tag to output content. -->
7
8 <%-- taglib directive --%>
9 <%@ taglib uri ="advjhtp1-taglib.tld" prefix = "advjhtp1" %>
10
11 <html xmlns = "http://www.w3.org/1999/xhtml">
12
13 <head>
14 <title>Simple Custom Tag Example</title>
15 </head>
16
17 <body>
18 <p>The following text demonstrates a custom tag: </p>
19 <h1>
20 <advjhtp1:welcome />
21 </h1>
22 </body>
23
24 </html>
Use
taglib directive to
include use tags in tag library
Use
taglib directive to
include use tags in tag library
Use custom tag
welcome
to insert text in the JSP
Use custom tag welcome
to insert text in the JSP