JSP comments (in the page, right-click to see if the source code is visible)
1. Explicit annotations visible to clients
<!--comment Content--
2. Implicit annotations that are not visible to the client
Single-line comment//comment content
Multiline comment/* Comment content */
JSP comment <%--Comment content--%>
Explicit content is sent to the client, and implicit content is not sent to the client
Scriptlet All Java programs that are embedded in HTML code must be marked with the scriptlet.
<%%>
You can define local variables in markup, write statements
<%!%>
You can define global variables, methods, and classes in markup. The defined content can be used in <%%>. <%!%> no other content can appear.
<%=%>
You can output a variable or a specific content in a tag
<jsp:scriptlet>java scriptlet Code </jsp:scriptlet>
To prevent confusion, it is equivalent to <%%>. It's good to be nice.
Page directive
<% @page property = "Content"%> defines the related properties of a JSP page
Contenttype= "TEXT/HTML;CHARSET=GBK" defines the character encoding, the MIME type of the page response
Iserrorpage can be set to TRUE or False
ErrorPage to the Display page after error, to use with Iserrorpage
Import page Pour the Action pack
PS:MIME specifies what application the browser should use to open the extension file when it is accessed. Setting an error may cause the content that should be displayed to be programmed one now prompt box
Pageencoding refers to the encoding of the JSP file itself, while the CharSet in ContentType refers to the content encoding that the server sends to the client.
Static inclusions
<%@ include file= "file path"%>
JSP inserts a file that contains text or code at compile time
Dynamic inclusion
If the static page static contains the sample processing, if the dynamic page first dynamic processing, and then the processed results are included in the
<jsp:include page= "file path" >
<jsp:param name= "parameter name" value= "parameter contents"/>
</jsp:include>
The passed parameter is used Request.getparmeter ("parameter name") in the contained page;
Jump Instructions
Do not pass parameters
<jsp:forward page= "Jump page"/>
Passing parameters
<jsp:forward page= "Jump page" >
<jsp:param name= "parameter name" value= "parameter contents"/>
</jsp:forward>
Next article: Javaweb series-JDBC
This article is from the "Lincoln" blog, please be sure to keep this source http://president.blog.51cto.com/4990508/1787043
Javaweb Series-jsp Basic syntax