Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48701
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 9 Mar 2010 14:04:58 +0000 (14:04 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 9 Mar 2010 14:04:58 +0000 (14:04 +0000)
Add a system property to allow disabling enforcement of a requirement of JSP.5.3.
The specification recommends, but does not require us to enforce it.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@920880 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/Generator.java
webapps/docs/config/systemprops.xml

index ecbb946..d761cf6 100644 (file)
@@ -78,6 +78,15 @@ class Generator {
     private static final String VAR_INSTANCEMANAGER =
         System.getProperty("org.apache.jasper.compiler.Generator.VAR_INSTANCEMANAGER", "_jsp_instancemanager");
 
+    /* System property that controls if the requirement to have the object
+     * used in jsp:getProperty action to be previously "introduced"
+     * to the JSP processor (see JSP.5.3) is enforced.
+     */ 
+    private static final boolean STRICT_GET_PROPERTY = Boolean.valueOf(
+            System.getProperty(
+                    "org.apache.jasper.compiler.Generator.STRICT_GET_PROPERTY",
+                    "true")).booleanValue();
+
     private ServletWriter out;
 
     private ArrayList<GenBuffer> methodsBuffered;
@@ -1058,7 +1067,7 @@ class Generator {
                         + ")_jspx_page_context.findAttribute("
                         + "\""
                         + name + "\"))." + methodName + "())));");
-            } else if (varInfoNames.contains(name)) {
+            } else if (!STRICT_GET_PROPERTY || varInfoNames.contains(name)) {
                 // The object is a custom action with an associated
                 // VariableInfo entry for this name.
                 // Get the class name and then introspect at runtime.
index aa6571a..8eabe30 100644 (file)
       be used.</p>
     </property>
 
+    <property name="org.apache.jasper.compiler. Generator.STRICT_GET_PROPERTY">
+      <p>If <code>true</code>, the requirement to have the object referenced in
+      <code>jsp:getProperty</code> action to be previously "introduced"
+      to the JSP processor, as specified in the chapter JSP.5.3 of JSP 2.0 and
+      later specifications, is enforced. If not specified, the specification
+      compliant default of <code>true</code> will be used.</p>
+    </property>
+
     <property name="org.apache.jasper.compiler. Parser.STRICT_QUOTE_ESCAPING">
       <p>If <code>false</code> the requirements for escaping quotes in JSP
       attributes will be relaxed so that an unescaped quote will not