Search code examples
javajsptomcatmigrationjsp-tags

printing "" instead of "null" in jasper JSP (tomcat)


I'm migrating an application from Weblogic to tomcat (8.0.35). in Weblogic we used the "printNull = false" option which means that when a var is null, <%=var%> will print an empty string (instead of "null", as the Specification require), there is no equivalent option for Jasper jsp.

What can be done to achieve this behavior?

p.s. changing the jsp files is not an option, there are simply too many of them.


Solution

  • I ended up patching jasper.jar, specifically method: public void visit(Node.Expression n) at Generator.java, now to the resulted .java file of the jsp prints empty string in case of nulls.

    This is not a great solution, and that is exactly what i wanted to avoid, but it looks like there is no such option.