JAVA JSP Technology

Source: Internet
Author: User
Tags html comment

The nature of a JSP is a class file that is stored in the work folder in Tomcat (if you use Tomcat), which inherits the Httpjspbase class, and the Httpjspbase class inherits the HttpServlet class. So it's essentially a servlet class file.

JSP script:

1) <%java Code%>-----Internal Java code translated into the internal of the service method
2) <%=java variable or expression%>-----will be translated into service method internal Out.print ()
3) <%!java Code%>----will be translated into the content of the servlet members

Java Annotations:

1) HTML comment:<!--annotation Content-----Visible range JSP source code, translated servlet, page display HTML source code
2) Java Comment://single-line comment/* Multiline comment */-visible range JSP source translated servlet
3) JSP Comment: <%--comment content--%>-----Visible scope JSP source code visible, higher security

Java output:

Response and <%= parameters > outputs, response output is faster because the program will read the response cache and then read the <%= parameters > output to the response cache.

The default size of the out cache is 8kb, which can be set with the buffer of the page directive, and if set to 0, the output stream of the response and the out output stream are output in the order in which they are ordered.

Three major directives:

Page directive: is the default in the development of pages, the format; <%@ page property Name 1 = "Property value 1" Property Name 2 = "Property value 2" ...%>

Types of languages that can be embedded in language:jsp scripts
Pageencoding: The current JSP file itself is encoded---internal can contain contenttype (write it no longer write the following)
ContentType:response.setContentType (Text/html;charset=utf-8)
Session: Whether the JSP automatically creates a session when translating
Import: Importing Java Packages
ErrorPage: Which page to jump to when the current page is faulted
Iserrorpage: The current page is a page that handles errors

Directives for include:

Page static inclusion, write a JSP file to another JSP file

<%@ include file= "covered file address"%>

Static pages include content in the form of code written into the JSP file, the dynamic page is the address of the write, to include the file address to write in

Dynamic Page contains (dynamically included): <jsp:include page= "included pages"/>

TAGLIB directive:
Introduction of tag libraries in JSP pages (Jstl tag library, struts2 Tag library)
Format: <%@ taglib uri= "tag Library address" prefix= "prefix"%>

JAVA9 large Implicit object

Out-------Output information

Request---------Page

Respose-------Client's reply

Apploaction--------Web Environment Context object (ServletContext)

Session---------Server Storage information

Config-----------server configuration, you can get the initialization configuration

Exception----exception on JSP error page

Page-----------refers to the instance of Serlet after the current page is converted

PageContext------JSP page container, scope

Servlets have 3 scopes, applocation,request,session

There are 4 scopes in the JSP, Applocation,request,session,pagecontext

Application: Scope of the entire Web application

Request: Scope once requests

Session: Scope one conversation

Pagecontex: Scope JSP page

PageContent scope and other scope methods are basically the same, there is a new method

Findattribute (String name)

from PageContext domain, request domain, session field, application domain attribute is fetched in a domain and will not be searched backwards

JAVA JSP Technology

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.