How to avoid Java code in JSP files? I'm new to Java EE and I know that something like the following three lines <%= x+1 %> <%= request.getParameter("name") %> <%! counter++; %> is an old school way of coding and in JSP version 2 there exists a method to avoid Java code in JSP files. Can someone please tell me the alternative JSP 2 lines, and what this technique is called? Solution: The use of scriptlets (those <% %> things) in JSP is indeed highly discouraged since the birth