Summary of basic Jsp knowledge

Source: Internet
Author: User

Jsp (the first choice for SUN enterprise-level applications) We have been learning it for a long time. We have summarized a little basic knowledge in the process and used it to share it with beginners until we finally made a small project, the pet hospital also uses Jcreater4.0, our simplest tool. Oh, it was found that the development speed was so fast in Ecliplse, but this laid our foundation .... if you don't want to talk about it, send a summary of what you have learned to this point, and hope to bring convenience to beginners. At the same time, I hope that the experts will give you some advice .....

First, let's take a look at our jsp (SUN's first choice for enterprise-level applications) Course: The first part is Servlet technology, including Servelt entry, session tracking, JavaMal and Servlet. the second part is jsp (the first choice for SUN enterprise-level applications) technology, including: Introduction to jsp (the first choice for SUN enterprise-level applications) and use of jsp (the first choice for SUN enterprise-level applications) scripts and instructions, jsp (preferred for SUN Enterprise Applications) Implicit objects, standard actions in JavaBean and jsp (preferred for SUN Enterprise applications), jsp (preferred for SUN Enterprise Applications) expressions language, custom tags, jsp (preferred for SUN Enterprise Applications) User-Defined table store. the third part is the design pattern of the filter, including the design pattern of the filter and MVC.

I. Servlet knowledge and Common Errors and rules.

1. The process of desktop running programs and WEB applications is essentially the same-the process of request and response.
2. http protocol (Hypertext Transfer Protocol)
1). Stateless: there is no connection between multiple requests.
2). Used to send requests and response messages over the internet
3). Use the port to receive and send messages. The default port is port 80.
Port: memory buffer (receiving data with multiple threads)
Windows: Port 0---65535
0---4096 indicates the system Port
3. What is Servlet?
Server let Server-side applets.
A program written by the server to process requests sent by the client and respond to the client in java.
Servlet only runs on the server

4. Servlet details:
Import java. io .*;
Import javax. servlet .*;
Import javax. servlet. http .*;
Import java. util .*;
Public class MyServlet extends HttpServlet
{
Public void doGet (HttpServletRequest request, HttpServletResponse response)
Throws ServletException, IOException
{
Response. setContentType ("text/html; charset = gb2312 ");
Request. setCharacterEncoding ("gb2312 ");

Response. sendRedirect ("Login. jsp (preferred for SUN Enterprise Applications)"); // redirect Method
Request. getParameter (""); // read client data

// The following methods are used for forwarding. Different from redirection, data is not lost during forwarding.
ServletContext context = this. getServletContext ();
RequestDispatcher dispatcher = context. getRequestDispatcher ("/welcome. jsp (preferred for SUN Enterprise Applications )");
Dispatcher. forward (request, response );

... // The following method is included (rarely used)
Dispatcher. include (request, response );

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.