Jsp internal components let us pick up request reponse and run it on the webpage ^^^

Source: Internet
Author: User
Tags html form
JSP has the following nine basic built-in components (corresponding to the six internal components of ASP ):
Request client request, which contains parameters from the GET/POST request
Response returned from the response webpage to the client
The pageContext page is managed here.
Session-related session period
Content being executed by application servlet
Out is used to send response output.
Configuration servlet framework
Page JSP page itself
Exception for the error webpage, exceptions not captured
You can use them to access the servlet that executes JSP code.
To avoid talking about too many details about Servlet APIs, let's examine what you can do with them:
Without using the formula, you can directly access the internal out object to print something to response:
<% Out. println ("Hello"); %>
You do not need to directly transmit parameters to JavaBean. You can obtain the parameter values according to the request parts:
<% String name = request. getParameter ("name ");
Out. println (name); %>.
And so on.
The following describes session objects.
Session status maintenance is a must for Web application developers. There are multiple ways to solve this problem, such as using Cookies, hiding form input fields, or directly attaching status information to a URL. Java Servlet provides a continuously valid session object between multiple requests, which allows users to store and extract session status information. JSP also supports this concept in Servlet.
Many descriptions of implicit objects can be seen in Sun's JSP Guide (the implicit meaning is that these objects can be directly referenced and do not need to be explicitly declared, no special code is required to create its instance ). For example, the request object is a subclass of HttpServletRequest. This object contains all information about the current browser request, including Cookies, HTML form variables, and so on.
The session object is also such an implicit object. This object is automatically created when the first JSP page is loaded and associated with the request object. Similar to session objects in ASP, session objects in JSP are very useful for applications that want to complete a transaction through multiple pages.
To illustrate the specific application of the session object, we use three pages to simulate a multi-page Web application. The first page (q1.html) only contains an HTML form that requires the user name to be entered. The code is as follows:
<HTML>
<BODY>
<Form method = post action = "q2.jsp">
Enter your name:
<Input type = text name = "thename">
<Input type = submit value = "SUBMIT">
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.