重复的 Freemarker 警告消息 - 渲染标记超出操作范围
我有一个在tomcat9 / ubuntu服务器上运行的Struts Web应用程序(Core v2.5.30)。 Syslog文件获得了许多错误消息实例,类似于以下内容。应用程序中没有直接访问的JSP,并且JSP通过web.xml
在消息中提到的URL中被阻止。
[2022-04-11 13:17:39] [info] [warn] 2022-04-11 13:17:39 [https-openssl-nio-nio-8443-exec-5] /xhtml/head.ftl不用行动范围,不建议直接访问JSP!请阅读 https://struts.apache.org/security/security/security/security/##永无止境的jsp-files
是什么导致这些消息出现?
I have a Struts web application (core V2.5.30) running on Tomcat9 / Ubuntu server. The syslog file is getting numerous instances of error messages similar to the following. There are no directly accessible JSP's in the application, and JSP's are blocked via web.xml
per advice in the URL mentioned in the message.
[2022-04-11 13:17:39] [info] [WARN ] 2022-04-11 13:17:39 [https-openssl-nio-8443-exec-5] FreemarkerTemplateEngine - Rendering tag /template/xhtml/head.ftl out of Action scope, accessing directly JSPs is not recommended! Please read https://struts.apache.org/security/#never-expose-jsp-files-directly
What's causing these messages to appear?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
index.jsp
中的某些内容正在调用JSP页面。它可能是包含或转发的页面。有了相同的请求,但所谓的页面包含Struts标签。如果您将其定义为Web应用程序描述符文件中的
>
,则通过Web容器本身处理索引页面。因此,它没有处理Struts2滤波器,因此没有动作范围。如果要通过Struts2进行处理,则应创建结果返回此页面的操作映射。
Something inside
index.jsp
is calling JSP page. It may be an included or forwarded page. With the same request but the page which is called contains struts tags.Index page is handled by web container itself if you defined it as
<welcome-file>
in the web application descriptor file. So it didn't handle struts2 filter and hence no action Scope was available.If you want to make it handled by struts2 you should create the action mapping that returns this page as result.