Eclipse对JSF文件中的EL表达式给出了太多的错误错误和警告 [英] Eclipse gives too many false errors and warnings on EL expressions in JSF files

查看:158
本文介绍了Eclipse对JSF文件中的EL表达式给出了太多的错误错误和警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的情况.我有一个最初是在RAD中开发的应用程序,它使用类似

I have run into a weird situation. I have an application which was originally developed in RAD and uses a construct like

rendered="#{bean.show and user.can('foo')}"

我们的开发人员混合使用RAD和Eclipse Juno/Kepler.因此,我们需要使代码在两种环境中都能工作.

Our developers use mix of RAD and Eclipse Juno / Kepler. So we need to make the code work in both the environments.

在RAD中,以上行不会产生任何错误.当我将项目导出为归档文件并将其导入Eclipse Juno时,它将生成此错误

In RAD, the above line does not generate any errors. When I export the project as archive and import it into Eclipse Juno, it generates this error

不能将表达式运算符应用于方法绑定

Cannot apply expression operators to method bindings

我们的环境是Websphere 8.5,RAD/Eclipse,JSF 2.1

Our environment is Websphere 8.5, RAD / Eclipse, JSF 2.1

我该如何解决?

推荐答案

通常,如果在Eclipse的JSF文件中遇到错误的EL验证错误,请尝试在 Window> Preferences> Web> JavaServer Faces中浏览工具>验证,并调整当前(不必要)在错误处设置的某些设置.

In general, if you face a false EL validation error in a JSF file in Eclipse, try peeking around in Window > Preferences > Web > JavaServer Faces Tools > Validation and tune some settings currently (unnecessarily) set at Error.

您的特定问题是由将操作符应用于方法绑定"触发的,该问题实际上默认为 Error .如果某种程度上无法将Eclipse升级到最新版本,则将其重新设置为警告应该会降低它的音量.

Your particular problem is triggered by "Applying operator to method binding" which indeed defaults to Error. If upgrading Eclipse to most recent version is somehow not an option, setting it back to Warning should tone down it.

毕竟,Eclipse中的EL验证是一个史诗般的失败.似乎它正在使用正则表达式来验证EL语法,而不是像EL本身所做的那样基于真正的基于堆栈的解析器.在类型强制问题"和类型分配问题"下有多个条目,它们不必要地设置为 Error ,并且已知会导致错误的错误.

After all, EL validation in Eclipse is quite an epic fail. It seems like it's using regular expressions to validate EL syntax instead of a true stack based parser like as EL itself is doing. There are several entries below "Type Coercion Problems" and "Type Assignment Problems" which are unnecessarily set to Error and known to cause false errors.

  • Method must have signature "String method() ...[etc]..." but has signature "void method()"
  • Eclipse errors on #{component.valid}: "valid cannot be resolved as a member of component"

这篇关于Eclipse对JSF文件中的EL表达式给出了太多的错误错误和警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆