Servlet Registration Method

Source: Internet
Author: User

In Weblogic, you must register the Servlet before using it. How can you register the Servlet? Adi's reference to SUN's documentation http://java.sun.com/j2ee/dtds/web-app_2_2.dtd is summarized as follows:
Find the file web. xml in the c: \ bea \ wlserver6.0sp1 \ config \ mydomain \ applications \ defawebwebapp_myserver \ web-inf \ directory and open it in notepad. The following content is displayed:

 
 
  1. <?xml version="1.0" ?> 
  2. <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2
    //EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";> 
  3. <web-app> 
  4. </web-app>  

We want to modify this content. Refer to SUN's explanation of each element in the document. The Modification result is as follows:

 
 
  1. <?xml version="1.0" ?> 
  2. <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web 
    Application 1.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";> 
  3. <web-app> 
  4. <servlet> 
  5. <servlet-name>TestUseServlet</servlet-name> 
  6. <servlet-class>testservlet.TestUseServlet</servlet-class> 
  7. </servlet> 
  8. <servlet-mapping> 
  9. <servlet-name>TestUseServlet</servlet-name> 
  10. <url-pattern>DBTest</url-pattern> 
  11. </servlet-mapping> 
  12.  
  13. <servlet> 
  14. <servlet-name>Myservlet</servlet-name> 
  15. <servlet-class>mypackage.Myservlet</servlet-class> 
  16. </servlet> 
  17. <servlet-mapping> 
  18. <servlet-name>Myservlet</servlet-name> 
  19. <url-pattern>Myservlet</url-pattern> 
  20. </servlet-mapping> 
  21. </web-app>  

The above is the Servlet registration method.

  1. New Servlet and JSP features
  2. Talking about Servlet Web Server
  3. Implement Servlet applications in Weblogic
  4. Communication between Servlet and CGI
  5. Use MIDlet to activate Servlet

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.