• 3.7k

java项目,如下web.xml中,为什么hfRequest可以,而HFRequestDispather却不进入后台呢?

<servlet>
    <description></description>
    <display-name>HFRequestDispather</display-name>
    <servlet-name>HFRequestDispather</servlet-name>
    <servlet-class>com.sunyard.serlet.HFRequestDispather</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>HFRequestDispather</servlet-name>
    <url-pattern>/HFRequestDispather</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>hfRequest</servlet-name>
    <servlet-class>com.sunyard.serlet.HFRequestDispather</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>hfRequest</servlet-name>
    <url-pattern>/hfRequest</url-pattern>
  </servlet-mapping>

hfRequest可以进入后台,
而HFRequestDispather却不进入后台,也不报错,页面空白
image

阅读 134
评论
    2 个回答
    • 1.3k

    我瞎猜啊,应该是上面的配置被下面的覆盖了,你改成这样试试:

    <servlet>
        <servlet-name>hfRequest</servlet-name>
        <servlet-class>com.sunyard.serlet.HFRequestDispather</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>hfRequest</servlet-name>
        <url-pattern>/hfRequest</url-pattern>
    </servlet-mapping>
    
    <servlet>
        <description></description>
        <display-name>HFRequestDispather</display-name>
        <servlet-name>HFRequestDispather</servlet-name>
        <servlet-class>com.sunyard.serlet.HFRequestDispather</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>HFRequestDispather</servlet-name>
        <url-pattern>/HFRequestDispather</url-pattern>
    </servlet-mapping>

    如果此时的结果正好是HFRequestDispather能请求而hfRequest请求不到的话,就说明我的猜测是正确的。如果没有发生变化,那就是猜错了。。

      相似问题
      推荐文章