Dynamically include files in JSP

This is a good example to dynamically include a header file in JavaServer Pages (JSP):

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>JSP Page</title>
  </head>
  <body>        
  <c:set var="userAgent" scope="page" value="${header['User-Agent']}"/>
  <c:choose>
    <c:when test="${fn:contains(userAgent,'iPhone')}">
      <%@include file="header_iphone.jsp" %>
    </c:when>
    <c:when test="${fn:contains(userAgent,'iPad')}">
      <%@include file="header_ipad.jsp" %>
    </c:when>
    <c:when test="${fn:contains(userAgent,'Android')}">
      <%@include file="header_android.jsp" %>
    </c:when>
    <c:otherwise>
      <%@include file="header_other.jsp" %>
    </c:otherwise>
  </c:choose>
</body>
</html>