JSP Syntax Detailed Release Date: 2004-02 HTML Comment Displays a comment on the client. JSP syntax ] -> Example 1 Generate and the same data as above in the client's HTML source code: -> Displayed in the client's HTML source code as: Description / R This annotation and HTML is very like That is, it can be seen in "View Source / Code /". The only thing is that you can use expressions in this comment (see 2 shown in Example 2). This expression is not different, different from the page You can use a variety of expressions, as long as it is legal. More please see the expression hidden comment written in the JSP program, but not send it to the customer. JSP syntax <% -%>: <% @ page language = "java"%>
a comment test title> head> A Test of Comments h2> body> html> Description / R By hidden comment marked characters are ignored when JSP compile Drop. This comment is useful when you want to hide or annotate your JSP program. The JSP compiler does not compile the statement between <% - and -%>, which does not display in the customer's browser, nor does it see the declaration in the JSP program in the source code. Variables and methods JSP grammar <%! Declaration; [declaration;] ...%> <%! Int i = 0;%> <%! Int A, b, c;%> <%! Circle a = New circle (2.0);%> Description / R Declare that the variables and methods you want to use in the JSP program. You must also do this, or you will make mistakes. You can declare multiple variables and methods in one time, as long as you end, you will be legal in Java. When you declare methods or variables, please pay attention to some of the following rules: The statement must be ";" end (Scriptlet has the same rules, but the expression is different). You can use it directly in <% @ Page%> Contains the already declared variables and methods, do not need to be re-declared. A statement is only valid in one page. If you want each page to use some statements, it is best to write them into a separate file, then use <% @ include%> or element.