Java servlet not dispatching to another servlet

前端 未结 4 1222
无人共我
无人共我 2021-01-24 08:58

I have 2 servlets, \"HomeController\" and \"SearchController\". On the home.jsp I have a form that has a search box and when submitted actions to \"Search\"

 <         


        
4条回答
  •  时光说笑
    2021-01-24 09:19

    I think I found your problem, your code is actually ok, the web.xml is the one that has the problem:

    
        HomeController
        /Home
        /
    
    

    You have there multiple url-patterns in a servlet mapping. Try this instead

    
        HomeController
        /
    
    
        HomeController
        /Home
    
    

    It may resolve your issue, web containers are sometimes very picky with these details.

    Source: http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd

    The xsd specifies for the servlet-mapping type:

    
      
      
    
    

    There is no multiple url-patterns there.

提交回复
热议问题