>_< " supports the syntax of two annotations in JSP, one is explicit annotation, the client is allowed to see, and the other is an implicit comment, which the client is not able to see.
<!--comment Content--
- Format one://comment, single line comment
- Format two:/* comment */, multiline comment
- Format three: <%--comment--%>,jsp Comment
>_< " jsp embedded into the HTML file, JSP is the Java language, in order to embed and effectively hold the need to scriptlet (script applet)."
- All Java programs that are embedded in HTML code must be marked with Scriplet, with a total of three scritplet codes in the JSP:
- The first type: <%%>: You can define local variables, write statements in this Scriptlet
- The second kind: <%!%>: In this scritplet, you can define global variables, methods, classes
- The third type: <%=%>: Used to output a variable or a specific content
123<title>beautifulzzzz</title>45<body>6<%!7public static final String INFO = "beautifulzzzz";//Defining Global Constants8%>9<%!TenPublicintAddintXintY) {//Defining Methods One returnX +y; A } -%> -<%! theClass Person {//defining the Person class -private String name;//define the Name property -PrivateintAge//defining The Age property -Public person (String name,intAge) {//Setting property content by constructing methods + This. name = name;//Assigning a value to the Name property - This. Age = Age;//Assigning a value to the Age property + } APublic String toString () {//Overwrite ToString () method at return"Name =" + This. Name + "; age =" + This. Age; - } - } -%> -<%//write a common scriptlet -Out.println ("//Output Global Constants inOut.println ("//Calling Methods -Out.println ("NewPerson ("Zhangsan", "+") + "//Build Object to%> + -<% the intx=10; *String info= "Beautifulzzzz"; $Out.println (");Panax NotoginsengOut.println ("); -Out.println ("//write the output statement directly here the%> + A the +</body> -This JSP code will be placed in the root directory of its own, and then enter http://localhost/mldn/hello.jsp Run ~
[Java Web] 5\jsp (1) Comments & Scriptlet