eclipse 表达式语言在 tomcat 7 中跳过标识符检查

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15900044/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:21:15  来源:igfitidea点击:

Expression Language skip identifier check in tomcat 7

javaeclipsetomcat

提问by commit

I got following error :

我收到以下错误:

SEVERE: Servlet.service() for servlet jsp threw exception
javax.el.ELException: The identifier [case] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.

It is due to in tomcat 7 by default SKIP IDENTIFIER CHECK feature is false(which was true in tomcat 6 and below) and I use "case" in regular expression and caseis identifier so it throws error.

这是由于在 tomcat 7 中默认情况下 SKIP IDENTIFIER CHECK 功能为 false(在 tomcat 6 及以下版本中为 true),我在正则表达式中使用“case”,而case是标识符,因此它会引发错误。

I found following solution: javax.el.ELException: The identifier [return] is not a valid Java identifier

我找到了以下解决方案: javax.el.E​​LException: The identifier [return] is not a valid Java identifier

But it would not work for me because I don't want to make changes in my code. So I want solution to configure tomcat 7 to SKIP IDENTIFIER CHECK to true.

但这对我不起作用,因为我不想对我的代码进行更改。所以我想要将 tomcat 7 配置为 SKIP IDENTIFIER CHECK 为 true 的解决方案。

Even after lots of googling I didn't find way to do this. I am using eclipse juno and tomcat 7, please help me regard this.

即使经过大量的谷歌搜索,我也没有找到方法来做到这一点。我正在使用 eclipse juno 和 tomcat 7,请帮我解决这个问题。

回答by commit

Finally got solution for eclipse. Add below line to the location I specify

终于得到了eclipse的解决方案。将以下行添加到我指定的位置

-Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true

Please look for below step by step images

请寻找下面的分步图片

STEP 1 :

Step 1

第1步

STEP 2 :

Step 2

第2步

STEP 3 :

Step 3

第 3 步

Cheers. :)

干杯。:)

回答by Mark Thomas

Create a setenv.[bat|sh] file in CATALINA_HOME/bin (i.e. alongside all your other scripts) and set the system property in that file. On Windows you'd create setenv.bat with the following contents:

在 CATALINA_HOME/bin 中创建一个 setenv.[bat|sh] 文件(即与所有其他脚本一起)并在该文件中设置系统属性。在 Windows 上,您将使用以下内容创建 setenv.bat:

SET CATALINA_OPTS=%CATALINA_OPTS% -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true

On Linux you'd create setenv.sh with the following contents:

在 Linux 上,您将使用以下内容创建 setenv.sh:

export CATALINA_OPTS="$CATALINA_OPTS -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true"

You can repeat those lines (changing the system property name) to set multiple system properties in the same setenv.[bat|sh] file.

您可以重复这些行(更改系统属性名称)以在同一个 setenv.[bat|sh] 文件中设置多个系统属性。

回答by Istiyak Vasiwala

We can also add following command to catalina.sh file under the tomcat_home dir/bin

我们也可以在 tomcat_home dir/bin 下的 catalina.sh 文件中添加以下命令

CATALINA_OPTS="-Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true"

CATALINA_OPTS="-Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true"

回答by vidhyadhar

I had the same problem while migrating my present application to Tomcat 7 it is(jsf 1.2 with ice faces 1.8.2). I have solved it by including a bat file with name setenv.bat with the below content in it. 'SET CATALINA_OPTS=%CATALINA_OPTS% -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true'

我在将我目前的应用程序迁移到 Tomcat 7 时遇到了同样的问题(jsf 1.2 with ice faces 1.8.2)。我通过包含一个名为 setenv.bat 的 bat 文件来解决它,其中包含以下内容。'SET CATALINA_OPTS=%CATALINA_OPTS% -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true'

i have included it in TomcatInstallationDirectory/bin.

我已将其包含在 TomcatInstallationDirectory/bin 中。

it is read by catalina.bat file. in the below line 'call "%CATALINA_BASE%\bin\setenv.bat"'.

它由 catalina.bat 文件读取。在下面的行中'调用“%CATALINA_BASE%\bin\setenv.bat”'。

Hence my jspx pages are rendered appropriately

因此我的 jspx 页面被适当地呈现

I had went through the following documentation by tomcat:

我已经通过 tomcat 浏览了以下文档:

https://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt

https://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt

please do post all the solution you made

请发布您所做的所有解决方案

回答by Alex

If you are using Eclipse, for example, you have to add the folowing line to catalina.properties in Servers folder, (look for it in Package Explorer, and select your corresponding Tomcat folder):

例如,如果您使用的是 Eclipse,则必须将以下行添加到 Servers 文件夹中的 catalina.properties,(在 Package Explorer 中查找,然后选择相应的 Tomcat 文件夹):

org.apache.el.parser.SKIP_IDENTIFIER_CHECK=true

Remember that Eclipse uses different location for configurations rather CATALINA original directories.

请记住,Eclipse 使用不同的位置进行配置,而不是 CATALINA 原始目录。

It's worthy to take a look on Tomcat's properties page, at https://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html

值得一看 Tomcat 的属性页面,位于https://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html