JSP 2.0 New Features

Published: Sunday, 27 August 2006

Tag library TLD lookup

If you specify the correct URI in your taglib declaration at the top of your JSP files, then the container will automatically know which taglib if the included jars have URI attributes correctly setup inside.

e.g. struts.jar has descriptors in /META-INF/tlds/. Each of these have a URI element, which the container can match against. This saves you having you extract these out to /WEB-INF.

Expression Language

EL scripting can now be enabled and evaluated by the container. There is no need to install jstl or struts-el taglibs. To enable container evaluation you will have to specify this in your web.xml deployment descriptor.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
         http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <el-ignored>false</el-ignored>
      <scripting-invalid>true</scripting-invalid>
    </jsp-property-group>
  </jsp-config>

el-ignored is set to false, so this means el will be evaluated by the container.

However, to escape HTML characters you will still need to use <c:out> or <bean:write> tags