JSP.2.11.2
Scriptlets can contain any code fragments that are valid for the scripting language specified in the language directive. Whether the code fragment is legal depends on the details of the scripting language (see Chapter JSP.6).
...
When all scriptlet fragments in a given translation unit are combined in order they appear in the JSP page, they must yield a valid statement, or sequence of statements in the specified scripting language.