In JSP, most of the scripts are small. Program The so-called script applet directly contains Java Code . In JSP, scriptlet is divided into three types: 1. <%>: defining local variables, compiling Statement 2. <%! %>: Defines global variables. Class and method 3 <% = %>: expression output, which is used to output variables or a specific value.
<%IntI = 10;IntJ = 20; Out. println (I*J); Out. println ("<H1>" + (++ I) + ");%>
1. I found that no matter how the above programs refresh the page, the content of I is still 11, which is fixed because it is re-declared every time.
<%!IntI = 10;IntJ = 20;%> <%Out. println (I*J); Out. println ("<H1>" + (++ I) + ");%>
2. In the program, you only need to refresh the page and add it by yourself, because it declares a global variable and only declares it once.
<%IntI = 10;%> <% = I %> <% = "Hello world !!! "%>
3. Expression output: Output a variable or a specific value.
Http://lixinghua.blog.51cto.com/421838/101379