Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Nó rất hữu ích và thuận tiện hơn trong quá trình học tập và thử nghiệm. Tôi recommendyou để cho phép servlet Invoker nếu bạn không quen thuộc với Tomcat. Bạn có thể kích hoạt chức năng này bằng cách thay đổi web.xml theo con đường conf. Các bước để cho phép các servlet Invoker như sau: 1. | Better Development Environment 45 It is useful and more convenient in the learning and testing process. I recom-mendyou to enable the invoker servlet if you are not familiar with Tomcat. You can enable this function by modifying the web.xml under the conf path. Steps to enable the invoker servlet are as follows 1. Locate the following two blocks in the web.xml file in the conf directory. -- servlet servlet-name invoker servlet-name servlet-class org.apache.catalina.servlets.InvokerServlet servlet-class init-param param-name debug param-name param-value 0 param-value init-param load-on-startup 2 load-on-startup servlet - servlet-mapping servlet-name invoker servlet-name url-pattern servlet url-pattern servlet-mapping 2. Remove the first line and last line of the above two blocks i.e. --and -- . 3. Save the web.xml file. You can turn off this function by adding back the first and last line to the blocks. 4. Create classes path under the C Tomcat 5.5 webapps ROOT WEB-INF. 5. Copy the simple.class of this book to the following path C Tomcat 5.5 webapps ROOT WEB-INF classes 6. Start a web browser. 7. Type http localhost 8080 servlet simple as the URL. The browser will display the screen as illustrated in Fig. 5.15. Address jgi http localhost 0OBŨ servlet simple Simple Figure 5.15. Screen of the simple servlet 46 5. Web Server and Related Technologies 5.5.4 Deployment of Servlets It will be better to put the source files and compiled files i.e. the class files in different directories when you have a lot of programs in your application. If you are using an IDE tool such as Jbuilder then the IDE will take care of compilation and put the class file in the right directory. However if you do not have an IDE on your computer you can use the following command javac -d directory_of_the-class_name.java For example the following command will compile a simple.java program and store the simple.class file in the c Tomcat 5.5 webapps ROOT WEB-INF classes. e.g.javac -d c Tomcat 5.5 .