JSP:
Java Server Pages: java server page (html tags either defined, may be defined java code)
used to simplify writing
JSP principle:
is essentially a Servlet!
1. The message server parses Qingqiu, find resources index.jsp
2. If found, the index.jsp convert .java files
Compile .java files, generating file .class bytecode
4 provides access by the byte code file
JSP instructions:
action: to configure JSP page, the resource file import
format:
<% @ directive name attribute name attribute value = 1 1 = Attribute Name Attribute Value 2 2 ...%>
Category:
1.page arranged JSP page
contentType: is equivalent to the response.setContentType ()
1. set the response mime type body and character set
2. set the encoding of the current jsp pages
import: leader packet
errorPage: exception occurs after the current page, will automatically jump to a specified error page
isErrorPage: identification whether the current page is an error page
true: yes, you can use the built-in object Exception
false: No, the default value. You can not use the built-in object Exception
2.include page contains. Import page resource file
<% @ the include File = "top.jsp"%>
3.taglib import resources
<% @ taglib prefix = "c " uri = "http://java.sun.com/jsp/jstl/core "%>
JSP Note:
1.html Note:
<- -!>: Comment Only html code fragment
2.JSP NOTE:
<% - -%>: all can be annotated
JSP scripting:
JSP to define how the Java code
1. <%>: Java code defined in the service. The method may define what service can define what jsp
2. <%%!>: java code is defined, the position of the members converted jsp java class
3 <% =%>:. java code is defined, is output to the on the page. Statement output in what can be called, the script on what can be defined.
JSP's built-in objects:
no need to obtain and created objects can be used directly in the jsp pages
jsp a total of nine built-in objects
request: a request
response: Response
out: output character stream object. You can output the data on the page. And response.getWriter () similar
response.getWriter () and out.write () the difference:
1. Before the real tomcat server responds to the client will first find the response data buffer, the buffer data to find out.
2.response.getWriter () output data always out.write before ()
pageContext
the session
the Application
Page
config
Exception