16.4 Preventing Use of Standard Scripting Elements

The JSP expression language provides succinct and easy-to-read access to scoped variables (Java objects stored in the standard locations). This capability eliminates much of the need for the explicit Java scripting elements described in Chapter 11. In fact, some developers prefer to use a no-classic-scripting-elements approach throughout their entire projects. You can use the scripting-invalid subelement of jsp-property- group to enforce this restriction. For example, the following web.xml file indicates that use of classic scripting elements in any JSP page will result in an error.

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

Core Servlets and JavaServer Pages (Vol. 1.Core Technologies)
Core Servlets and Javaserver Pages: Core Technologies, Vol. 1 (2nd Edition)
ISBN: 0130092290
EAN: 2147483647
Year: 2002
Pages: 194

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net