How to access static resources when mapping a global front controller servlet on /*

前端 未结 19 2352
轮回少年
轮回少年 2020-11-22 07:35

I\'ve mapped the Spring MVC dispatcher as a global front controller servlet on /*.

               


        
19条回答
  •  执念已碎
    2020-11-22 08:24

    After trying the filter approach without success (it did for some reason not enter the doFilter() function) I changed my setup a bit and found a very simple solution for the root serving problem:

    Instead of serving " / * " in my main Servlet, I now only listen to dedicated language prefixes "EN", "EN/ *", "DE", "DE/ *"

    Static content gets served by the default Servlet and the empty root requests go to the index.jsp which calls up my main Servlet with the default language:

    < jsp:include page="/EN/" /> (no other content on the index page.)

提交回复
热议问题