⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 web.xml

📁 在java中实现数据库的连接和xml再java中的使用
💻 XML
字号:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- Note that this doctype references a local copy of the DTD -->
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "web-app_2.2.dtd">


<!-- Define configuration and deployment information for a web application -->
<web-app>   
  <!-- Each servlet tag defines information about a servlet.  This one -->
  <!-- defines a name for a specific Servlet implementation class.  It maps -->
  <!-- /servlet/hello (relative to the webapp root) to the specified class -->
  <servlet id="hello_servlet_id">
    <servlet-name>hello</servlet-name>
    <servlet-class>com.davidflanagan.examples.servlet.Hello</servlet-class>
  </servlet>
  
  <!-- Here's another servlet tag.  This one also defines initialization -->
  <!-- parameters that the servlet reads in its init() method. -->
  <servlet>  <!-- The counter servlet -->
    <servlet-name>counter</servlet-name>  
    <servlet-class>com.davidflanagan.examples.servlet.Counter</servlet-class>
    <init-param>
      <param-name>countfile</param-name>         <!-- where to save state -->
      <param-value>/tmp/counts.ser</param-value> <!-- adjust for your system-->
    </init-param>
    <init-param>
      <param-name>saveInterval</param-name>      <!-- how often to save -->
      <param-value>30000</param-value>           <!-- every 30 seconds -->
    </init-param>
  </servlet>
  
  <servlet>  <!-- The query servlet -->
    <servlet-name>query</servlet-name>
    <servlet-class>com.davidflanagan.examples.servlet.Query</servlet-class>
    <!-- Configure all these init params for your database -->
    <init-param>
      <param-name>driverClassName</param-name>   <!-- JDBC driver classname -->
      <param-value>org.gjt.mm.mysql.Driver</param-value> <!-- mysql driver -->
    </init-param>
    <init-param>
      <param-name>url</param-name>               <!-- URL for the database -->
      <param-value>jdbc:mysql://dbserver.my.domain.com/dbname</param-value>
    </init-param>
    <init-param>
      <param-name>username</param-name>          <!-- Database username -->
      <param-value>david</param-value>
    </init-param>
    <init-param>
      <param-name>password</param-name>          <!-- Database password -->
      <param-value>secret</param-value>
    </init-param>
  </servlet>

  <!-- Note that you can define multiple named instances of a single -->
  <!-- servlet class.  If you have two different databases, for example, -->
  <!-- you could define another instance of the Query servlet using a -->
  <!-- with a different name and a different set of initialization params -->
  <servlet>  <!-- Another query servlet -->
    <servlet-name>queryOtherDatabase</servlet-name>
    <servlet-class>com.davidflanagan.examples.servlet.Query</servlet-class>
    <!-- Add init params here, or this servlet won't work right -->
  </servlet>
  
  <servlet>  <!-- The logout servlet -->
    <servlet-name>logout</servlet-name>
    <servlet-class>com.davidflanagan.examples.servlet.Logout</servlet-class>
  </servlet>

  <!-- A servlet mapping specifies URL prefixes or suffixes that cause a -->
  <!-- particular named servlet to be invoked.  This one specifies that any -->
  <!-- URL ending with ".count" will invoke the "counter" servlet -->
  <servlet-mapping>
    <servlet-name>counter</servlet-name>  <!-- A name from a <servlet> tag -->
    <url-pattern>*.count</url-pattern>    <!-- What URLs invoke it -->
  </servlet-mapping>
  
  <!-- This tag specifies session management information for our webapp --> 
  <session-config>
    <session-timeout>15</session-timeout> <!-- timeout after 15 minutes idle-->
  </session-config>
  
  <!-- Mapping information about the tag libraries used in the webapp -->
  <taglib>
    <!-- When you see this unique identifier for a tag library... -->
    <taglib-uri>http://www.davidflanagan.com/tlds/decor_0_1.tld</taglib-uri>
    <!-- ...use this local copy of the Tag Library Descriptor file -->
    <taglib-location>decor_0_1.tld</taglib-location>
  </taglib>
</web-app>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -