6.1. JSP Scripting Elements
Perhaps the easiest way to start with JSPs is doing something known as “scriptlets.” This is a good way to learn JSP, but a bad way to use JSP. With scriptlets, you embed the Java code directly in your JSP, and the code will be compiled and executed at the time the page is accessed. One obvious problem here is that the initial page load will be slow; just how slow depends upon the complexity of the servlet that needs to be generated and the power of the server.
An even bigger problem is the unwieldy development process. If you write Java code that has errors (not that you ever would), and compile the code with the javac compiler, many errors will be caught by the compiler before you even attempt to run the code. With ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access