TeamCity:此处不允许使用脚本元素 jsp:declaration、jsp:expression、jsp:scriptlet
我不知道从哪里开始看到这个错误消息。我尝试过谷歌搜索,但我始终无法确定收到此消息的确切原因。
我看过各种jsp教程,它们看起来都比较简单,所以我没有看到问题。
我正在为 JetBrains TeamCity 编写另一个插件,并且一直在我的 java 代码和 jsp 代码之间来回传递值,参数如下:
${parameterName}
每当我尝试使用像这样的标签放入真正的 jsp 代码时,
<%= new java.util.Date() %>
都会抛出此错误。
<%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here
任何帮助或建议表示赞赏。
I am not sure where to begin with this error message. I have tried googling, but I was never able to nail down a solid reason why I am getting this message.
I have looked at various jsp tutorials and they all seem relatively simple so I don't see the problem.
I am writing another plugin for JetBrains TeamCity and have been passing values back and forth between my java code and jsp code with parameters like this:
${parameterName}
Whenever I try to put in real jsp code with tags like
<%= new java.util.Date() %>
This throws this error.
<%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here
Any help or suggestions are appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
应用程序中是否不允许使用 scriptlet?在 web.xml 文件中查找
true
。Scriptlet 是一个错误。它们使得表达和逻辑很容易混合在一起。因此添加此标志是为了防止开发人员在应用程序中使用它们,并鼓励使用表达式语言和标签库。
Are scriptlets disallowed in the application? Look for
<scripting-invalid>true</scripting-invalid>
in your web.xml file.Scriptlets were a mistake. They make it too easy to mingle presentation and logic. So this flag was added to prevent developers from using them in an application and encourage Expression Language and tag libraries instead.
我也面临着同样的问题。我发现当我在自定义标签内使用脚本标签时会出现问题。我想脚本无效或类似的东西也可以为标签定义。只是一个指针。
I am also facing the same issue. I figured out that the problem occurs when I use scripting tag inside a custom tag. I guess the scripting-invalid or similar things can be defined for a tag too. Just a pointer.
您可以针对不同的 url 模式打开和关闭脚本/scriptlet,因此可以在 .tag 文件中关闭它,但在必要时在 .jsp 中打开它。下面是一个示例,尝试将您要使用的文件扩展名的 scripting-invalid 设置为 false,如果 JBoss 默认为 true,也许这会覆盖默认值:
You can scripting/scriptlets on and off for different url patterns, so it could be off for .tag files but on for .jsp if necessary. Below is an example, try setting scripting-invalid to false for the file extensions you want to use, maybe that will override the default if JBoss defaults to true:
如果您想允许 .jsp 中的 "<%! %>",则:
步骤 1:打开 web.xml
步骤 2:执行以下更改:
步骤 3:重新启动该应用程序。
就这样。
If you want to allow the "<%! %>" in the .jsp then:
Step-1: Open web.xml
Step-2: Do the following changes:
Step-3: Restart the app.
That's all.