A complete Javaweb project history 02-hello Servlet

Source: Internet
Author: User
Tags stub

Objective

The previous article introduced a lot of conceptual things, a variety of Baidu Google to put together a Hello Javaweb project, and what is the relationship, as long as the study every day will be exposed to new concepts of things, although to do is, the concept is not clear and what the relationship. There is only one purpose: To do a complete javaweb project.

First, create the Javawebservlet project

Please refer to the previous article

Second, create a HelloServlet class

In fact, the package can not be created separately, in the creation of the servlet, the Java package column filled with the name: Com.fwbc.servlet can automatically create the package.

Third, create a hello.jsp file

Iv. Modifying the HelloServlet class code
//before modifying the Doget method:    protected voidDoget (HttpServletRequest request, httpservletresponse response)throwsservletexception, IOException {//TODO auto-generated Method StubResponse.getwriter (). Append ("Served at:"). Append (Request.getcontextpath ()); }    //after modifying the Doget method:    protected voidDoget (HttpServletRequest request, httpservletresponse response)throwsservletexception, IOException {//TODO auto-generated Method StubRequest.getrequestdispatcher ("/web-inf/hello.jsp"). Forward (request, response); }
View CodeV. Operation of Javawebservlet Program

Here you can also refer to the previous article, in the browser input: Http://localhost:8080/JavawebServlet/HelloServlet

A complete Javaweb project history 02-hello Servlet

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.