Why put JSP in WEB-INF?

后端 未结 3 1063
死守一世寂寞
死守一世寂寞 2020-11-28 11:44

I noticed a common pattern is to put JSP pages in WEB-INF folder (as opposed to WAR root). What\'s the difference? Why is that preferred?

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 12:38

    Files in WEB-INF are not visible to the users. It's a bit safer that way.

    If (a contrived example) you are including db.jsp, but by itself it throws an exception, a malicious user can open http://yoursite.com/db.jsp and get some insight on your application (worst - the database credentials) from the exception message.

提交回复
热议问题