Just learn JSP students may not clear JSP and HTML page relationship, in fact, can be a JSP page as a special HTML page, just inserted in the HTML page Java program section and JSP tag, JSP page in the server after the execution or return an HTML page to the browser.
Here is how to insert Java code in the JSP page, in fact, mainly remember the role of several symbols on the line:
1, <%@%>: This represents instructions, mainly used to provide the entire JSP page-related information, and to set the JSP page related properties, such as the Web page encoding format, syntax, information and so on. There are currently three kinds of instructions: page, include, Taglib. The page instruction is the most complex JSP instruction, and its main function is to set the properties and related functions of the entire JSP page. The include directive represents the introduction of a package at JSP compile time, which is static, and the introduced file can be a JSP page, an HTML page, a text file, or a Java program. Taglib allows users to customize new labels.
2, <%! %>: is used to declare a method that declares the application's global variables or the current page. For example:
<%! String name = "Zhangsan"; %>
<%! public void Show () {
System.out.print (name);
} %>
3, <%%>: Used to insert Java code. For example:
<%if (Count > 0) {%>
<jsp:include page= "grrc.jsp" ></jsp:include>
<%}%>
4, <%=%>: Used to insert a Java expression. For example:
<div id= "Divtop" >
<jsp:include page= "<%=port.getf_link" (). Trim ()%> ">
<jsp:param name= "id" value= "<%=id%>" />
<jsp:param name= "SkinID" value= "<%=skinidstr%>"/>
< Jsp:param name= "width" value= "<%=widthstr%>"/>
</jsp:include>
</div>
5, <%----%>: Used to annotate JSP code. For example:
<%--/src/images/hwbgzdh.jpg" alt= "ss"/>--%>