Java Web Learning Note-1

Source: Internet
Author: User
Tags java web

1.servlet can theoretically handle many forms of request response, HTTP is just one of them, so httpservletrequest, HttpServletResponse are subclasses of ServletRequest and Servletresponse respectively, HttpServletRequest and ServletRequest are interfaces,  HttpServletRequest inherited from ServletRequest, httpservletrequest more than servletrequest some methods for the HTTP protocol. such as GetHeader (String name), GetMethod (), getsession (), etc.

2.HttpServletRequest implementation is based on different servers, Tomcat has the implementation of Tomcat, WebLogic has WebLogic implementation

3. Generate a unique file name: Uuid.randomuuid ();

When the 4.WEB container starts, it creates a corresponding ServletContext object for each Web application that represents the current Web application. Because all servlets in a web app share the same ServletContext object, communication can be achieved between servlet objects through ServletContext objects. Multiple servlets implement data sharing through ServletContext objects.

such as implementing a servlet's forwarding.

RequestDispatcher rd = Getservletcontext (). Getrequestdispatcher ("/1.jsp"); Root path relative to the root of the current context, not the file on the physical server

Rd.forward (Request,response);

Implementing Data interactions

This.getservletcontext (). SetAttribute ("Today", "Yestoday");

Java Web Learning Note-1

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.