uCosminexus Application Server, Web Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

6.3.1 Precautions related to the definition of script variables for the custom tag

This subsection describes the precautions when defining the script variables in the JSP custom tag, the differences in the operations of the JSP compilation depending on the usage of the JSP translation backward compatibility function, and also describes the definition of the JSP translation backward compatibility function.

Organization of this subsection
(1) Notes
(2) Differences in JSP compilation operations depending on the usage of the JSP translation backward compatibility function
(3) Defining the JSP translation backward compatibility function

(1) Notes

Notes for specifying the scope

If the script variable name and the script variable scope are repeated in multiple custom tags, the JSP compilation results differ depending on the versions of the Application Server. Specify the script variable scope using one of the followings:

The followings are the differences in operations in each Application Server version when script variables with the same names are specified in the JSP custom tag:

The following is an example wherein the scope is AT_BEGIN and custom tag <my:foo> defines the script variable of the variable name (var) specified in the attribute id:

Example of definition
<my:foo id="var" type="String">
 <%=var%>
</my:foo>
 
<my:foo id="var" type="String">
 <%=var%>
</my:foo>
  • With versions prior to 07-00
    Perform variable declaration with the script variable var in the Java code generated from JSP corresponding to the second custom tag. In this case, the range of scope 'AT_BEGIN' in each custom tag is as follows:

    [Figure]

    Therefore, compilation error occurs during the compilation of the Java source generated from JSP.
  • With version 07-00 and later versions
    Do not perform variable declaration with the script variable var in the Java code generated from JSP corresponding to the second custom tag. In this case, the range of scope 'AT_BEGIN' in each custom tag is as follows:

    [Figure]

    Therefore, even if the script variables of the same name are defined in the same scope, the compilation of the Java source generated from JSP is executed normally.
Notes for coding the scriptlet

When the Java source is generated from JSP, the Java code described in the scriptlet is not analyzed. Therefore, if you define the process for which the script variable scope is changed before and after the custom tag or in the body scriptlet, the JSP compiled results might return an error depending on the version of the Application Server version.

(2) Differences in JSP compilation operations depending on the usage of the JSP translation backward compatibility function

The differences in the compilation operations when the JSP translation backward compatibility function is used and when the function is not used with version 07-00 and later versions are as follows:

When the script variable name and the script variable scope is repeated in multiple custom tags:
  • Use the JSP translation backward compatibility function
    Perform variable declaration of script variables in Java code generated from JSP corresponding to the custom tag from the second time onwards.
  • Do not use the JSP translation backward compatibility function
    Do not perform variable declaration of script variables in Java code generated from JSP corresponding to the custom tag from the second time onwards.

(3) Defining the JSP translation backward compatibility function

To define the JSP translation backward compatibility function, specify the following parameter in the <configuration> tag of the logical J2EE server (j2ee-server) in the Easy Setup definition file:

webserver.jsp.translation.backcompat.customAction.declareVariable
Specifies whether or not to output the variable declaration of the script variables corresponding to the second custom tag in the Java code generated from the JSP file.

For details on the Easy Setup definition file and the parameters to be specified, see the uCosminexus Application Server Definition Reference Guide.