为什么把JSP放在WEB-INF中? [英] Why put JSP in WEB-INF?
本文介绍了为什么把JSP放在WEB-INF中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我注意到一个常见的模式是将JSP页面放在WEB-INF文件夹中(而不是WAR根目录)。有什么不同?为什么这是首选?
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?
推荐答案
WEB-INF
中的文件不是对用户可见。这样有点安全。
Files in WEB-INF
are not visible to the users. It's a bit safer that way.
如果(一个人为的例子)你包括 db.jsp
,但是本身它会引发异常,恶意用户可以打开 http://yoursite.com/db.jsp
并从您的应用程序(最差 - 数据库凭据)中获取一些信息异常消息。
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.
这篇关于为什么把JSP放在WEB-INF中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文