比方说我现在访问:http://localhost:8080/pages/xx.jsp,应该会报404,没有该页面,但是会显示出所用服务器的信息:
所以为了避免产生此类漏洞个,应该对错误进行处理,在web.xml添加对相应的错误页面:
<!-- 默认的错误处理页面 --> <error-page> <error-code>403</error-code> <location>/pages/403.html</location> </error-page> <error-page> <error-code>404</error-code> <location>/pages/404.html</location> </error-page> <!-- 仅仅在调试的时候注视掉,在正式部署的时候不能注释 --> <!-- 这样配置也是可以的,表示发生500错误的时候,转到500.jsp页面处理。 --> <error-page> <error-code>500</error-code> <location>/pages/500.html</location> </error-page>
这样再次访问: