What is a JSP?
Sun company developed a server-side dynamic page technical specifications.
JSP is actually a "jsp" suffix of the file, the content of the file is mainly HTML and a small amount of Java code, the container will automatically convert the JSP file into a servlet and then execute.
How do I write a JSP file?
Step1, create a file with a suffix of ". jsp".
Step2, in the file, add the following content:
(1) HTML (css.js): Write directly.
(2) Java code
1) Java code snippet
<% Java statements; %>
2) JSP expression
<%=java expression%>
(3) Implied object
1) What is a hidden object
in a JSP file, objects that can be used directly, such as Out,request,response.
2) Why are these hidden objects directly available?
(4) instruction
1) Notifies the container to do some extra processing when translating the JSP file into a servlet class, such as a guide package.
2) Instruction syntax
<%@ directive Name attribute = attribute value%>
3) PA GE directive
A.import properties: Guide package
such as <% @page import= "java.util.*"%>
B.contenttype properties: Settings
The content of the Response.setcontenttype.
C.pageencoding Property: Tells the container JSP file encoding
(some containers, when reading the contents of the JSP file, the default
is to follow the ios-8859-1 to decode, if the JSP file inside
contains Chinese, garbled).
How is JSP executed?
Step1, the container converts the JSP file into a servlet class.
HTML (CSS,JS)-------> Service method, use Out.write output.
<% Java statement%>-------> Service method, copy.
<%=java expression%>-------> Service method, Output using Out.print (Java expression).
Step2, the container invokes the servlet.
What is a JSP?