java EE基础知识

开发一个Servlet程序的步骤:

                                                        1)创建一个java类,继承HttpServlet类

                                                        2)重写HttpServlet类的doGet方法

                                                        3)把写好的servlet程序交给tomcat服务器运行!!!!

                                                                 3.1把编译好的servlet的class文件拷贝到tomcat的一个web应用中。(web应用                                                                                       的WEB-INF/classes目录下)                
                                                                 3.2在当前web应用的web.xml文件中配置servlet

                                                                                   

                                                                                   

                                                                                             HelloServlet

                                                                                             gz.itcast.HelloServlet

                                                                                   

                                                                                   

                                                                                   

                                                                                             HelloServlet

                                                                                              /hello

                                                                                   

                                                        4)访问servlet

                                                                           http://localhost:8080/myweb/hello

你可能感兴趣的:(Java-基础,Servlet)