Basic component
JSP has the following 9 basic built-in components (can correspond to the six internal components of the ASP):
Request user request, this request will contain parameters from Get / POST request
Response web page back to the user's response
The properties of the PageContext page are managed here
Session and request related session
Application Servlet is being executed
OUT is used to transfer the output of the response
Config servlet architecture components
Page JSP page itself
Exception For error web, unconcerned exceptions
You can use them to access servlets that perform JSP code. In order to avoid talking to the details of too many servlet APIs, let's see some things you can do with them:
You don't have to use an arithmetic, you can directly access the internal OUT object to RESPONSE:
<% out.println ("Hello");%>
You don't have to transfer parameters directly to JavaBean, you can get the value of the parameters as requested:
<% String name = request.getParameter ("name");
Out.println (Name);%>.
and many more.
The session object is focused below.
Session status maintenance is a problem that web application developers must face. There are several ways to solve this problem, such as using cookies, hidden form input fields, or directly attach status information to the URL. Java servlets provide a session object that continuously and valid between multiple requests that allow users to store and extract session status information. JSP also supports this concept in the servlet.
Many of the instructions on implied objects (implicit meanings can be directly referenced in the JSP guide in Sun), which do not need to be explicitly declared, and do not require special code to create an example. For example, a Request object, it is a subclass of HttpServletRequest. This object contains all information about the current browser request, including cookies, HTML form variables, and more. The session object is also such an implied object. This object is automatically created when the first JSP page is loaded and is associated with the Request object. Similar to session objects in ASP, the session object in JSP is very useful for applications that do you want to complete a transaction through multiple pages.
To illustrate the specific application of the session object, let's simulate a multi-page web application with three pages. The first page (Q1.html) only contains an HTML form requesting the username, the code is as follows: