问答详情
源自:5-3 [Java Web] 过滤器的分类3

eclipse如何配置servlet的web.xml支持异步

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">

  <display-name></display-name>

  <welcome-file-list>

    <welcome-file>login.jsp</welcome-file>

  </welcome-file-list>

  <servlet>

    <description></description>

    <display-name>AsynServlet</display-name>

    <servlet-name>AsynServlet</servlet-name>

    <servlet-class>com.imooc.servlet.AsynServlet</servlet-class>

  </servlet>

  <servlet-mapping>

    <servlet-name>AsynServlet</servlet-name>

    <url-pattern>/AsynServlet</url-pattern>

  </servlet-mapping>

</web-app>


提问者:zetkno 2017-07-26 00:41

个回答

  • qq_SherlockHolm_4
    2017-07-26 09:57:42

     <servlet>

        <servlet-name>LoginServlet</servlet-name>

        <servlet-class>com.imooc.serlvet.LoginServlet</servlet-class>

        <async-supported>true</async-supported>

      </servlet>

     //servlet标签有个属性,叫做async-supported,把把它设置为true就行,示例如上

    <servlet-mapping>

        <servlet-name>LoginServlet</servlet-name>

        <url-pattern>/servlet/LoginServlet</url-pattern>

      </servlet-mapping>