I want to display <title> elements with proper values in html pages. I have one base layout jsp and a corresponding tiles definition. I'd like to set the value of the <title> tag on a per page basis, possibly in the tile definition xml.
So far I have the following
tiles.xml:
<definition name="base" template="/WEB-INF/jsp/layouts/base.jsp">
<put-attribute name="page-title" value="" />
</definition>
<definition name="home" extends="base">
<put-attribute name="page-title" value="Homepage" />
</definition>
base.jsp:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><tiles:insertAttribute name="title" ignore="true" /></title>
...
The title attribute set in the home definition is not displayed. But why not? What is the correct way to do this?