为了定义servlet和url的对应关系,就是说通过那个url访问servlet,要注意是相对路径

解决方案 »

  1.   

    <servlet>
        <servlet-name>examineoperator</servlet-name>
        <servlet-class>oamodule.examine.ExamineOperator</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>examineoperator</servlet-name>
        <url-pattern>/examine/examineoperator</url-pattern>
      </servlet-mapping>
    假如webapplication的Path URI   D:\project\defaultroot
    name为myapplication
    那么在浏览器中输入 http://localhost:7001/myapplication/examine/examineoperator就可以访问这个servlet
    在jsp的里面提交到/examine/examineoperator也可以提交到这个servlet
      

  2.   

    不知道我的理解对不对
    是不是我在jsp中action = aa
    那么我在url-pattern中的就是/aa
      

  3.   

    上面可能没说清楚,
    我要在jsp中调用servlet
    那么我servlet中web.xml
    的配置url-pattern 是 /aa
      

  4.   

    因为用到的是相对路径,你action = aa,那么url-pattern中应该是/jsp所在路径/aa
    如果jsp放在根目录总就是/aa了