JSTL in XML Style JSP Pages

This section provides a tutorial example on how to use JSTL tags in XML style JSP pages. The JSTL library needs to be declared as an XML namespace in the 'root' element.

Since I like to write JSP in XML style, I have to find out how to use JSTL in XML style JSP pages. It took me some time to figure out this. Here is an example code, hello_jstl_xml.jsp:

<?xml version="1.0"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" 
   xmlns:c="http://java.sun.com/jsp/jstl/core" version="2.1"> 
<!-- hello_jstl_xml.jspx
 - Copyright (c) 2012, HerongYang.com, All Rights Reserved.
<jsp:directive.page contentType="text/html"/>
<jsp:scriptlet>out.println("Hello world!");</jsp:scriptlet>
<c:out value="Hello world! - from c:out"/>

As you can see in the example,

Last update: 2012.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

 Tomcat 7 Installation on Windows Systems

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

 Syntax of JSP Pages and JSP Documents

 JSP Application Session

 Managing Cookies in JSP Pages

 JavaBean Objects and "useBean" Action Elements

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

 EL (Expression Language)

Overview of JSTL (JSP Standard Tag Libraries)

 What is JSTL?

 Installing GlassFish JSTL 1.2 on Tomcat 7

 "Hello world!" with JSTL

JSTL in XML Style JSP Pages

 General Syntax of JSTL Tags

 NoClassDefFoundError - LoopTag/ForEachTag

 Installing JSTL 1.2 API JAR File

 JSTL Example - Loop Tag on Map Objects

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

 File Upload Test Application

 Outdated Tutorials


 PDF Printing Version