JSP from shallow to deep (2) — the first JSP
First JSP
In fact, JSP simply puts Java into HTML web pages. You can change the extension of existing HTML pages from ". HTML" to ". JSP", which is the best way to create the first JSP.
We can change the extension of the file in the previous exercise from ". HTML" to ". JSP". Then load the new file in the browser, that is, the file with ". JSP" as the extension.
At this point, you can see the output, but it takes longer. This phenomenon only occurs when you load it for the first time. If you reload it, the speed will be normal.
What the hell happened? It turns out that your JSP is transformed into a java file, compiled and loaded. The compilation is only carried out once, so it takes a little longer to load the first time. It turned out to be spent on compilation. At the second load, it no longer needs to compile, so the loader speed returns to normal. Here's a reminder that when you convert HTML files into JSP files, you need to recompile them.
Of course, just write HTML pages and turn them into JSP extension files are useless. In later tutorials, you will learn what can make JSP useful.