Scripts and notes

1, jsp script:

(1) <% java code%>

<h3>
  <%
    out.println("Today is the Seventieth Anniversary of the founding of the People's Republic of China.");
  %>
</h3>

In the page output:

<h3>
  <%
    int a=9,b=9;
    System.out.println(a*b);
  %>
</h3>

Output of the operational result in the console.

 It will be translated to the internal service method.

After the translation is:

 int a=9,b=9;
    System.out.println(a*b);

 

(2) <% = java variable or expression>

<h3>
  <%=123%>
</h3>

 

<h3>
  <%int a=9;%>
  <%=(a*a)%>
</h3>

 It will be translated into an internal service methods out, println ();

Namely: output to the page.

 

(3) <%! Java code%>

<h3>
  <%! String string="Today is the Seventieth Anniversary of the founding of the People's Republic of China.";%>
  <%=string%>
</h3>

 plus! After the number is translated to the position of the members, or the translation to the internal service method.

 

 2, Note: <% - -%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>jsp</title>
  </head>
  <body  bgcolor="aqua"><%--注释--%>
<h3>
  <%! String string="Today is the Seventieth Anniversary of the founding of the People's Republic of China.";%>
  <%=string%>
</h3>
  </body>
</html>

 

Guess you like

Origin www.cnblogs.com/zhai1997/p/11615737.html