This is default and expected behaviour. Apparently the previous server has some proprietary configuration setting for that. None in Tomcat comes to mind.
Regardless, scriptlets is a vintage technique and its use is discouraged over a decade. It has been succeeded by taglibs (like JSTL) and Expression Language (EL) in combination with a Servlet as controller.
E.g. in Servlet's doGet()
:
String str = null;
request.setAttribute("str", str);
request.getRequestDispatcher("page.jsp").forward(request, response);
and in page.jsp
:
The value of str is ${str}
EL will by default print nothing if the value equals null
while scriptlet expression (<%= %>
) by default prints whatever String#valueOf()
returns.
See also: