Eclipse错误“无法将表达式运算符应用于方法绑定”在渲染属性中使用AND运算符时 [英] Eclipse errors "Cannot apply expression operators to method bindings" when using AND operator in rendered attribute

查看:613
本文介绍了Eclipse错误“无法将表达式运算符应用于方法绑定”在渲染属性中使用AND运算符时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的情况。我有一个最初在RAD开发的应用程序,并使用一个像
rendered =#{alertHandler.showEBox and authenticatedUser.getAccess('acknowledgeAlert')}/ c $ c>



我们的开发人员使用RAD和Eclipse Juno / Kepler的组合。所以我们需要使代码在这两种环境中都可以工作。



在RAD中,上面一行不会产生任何错误。当我将项目导出为存档并将其导入Eclipse Juno时,会产生此错误



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



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





更新



似乎如果我改变评估到
rendered =#{authenticatedUser.getAccess('acknowledgeAlert')和alertHandler.showEBox}/>





如果我使用$而不是#用于评估,并保留原始订单,如
rendered = $ {alertHandler.showEBox and authenticatedUser.getAccess('acknowledgeAlert')}/>



似乎摆脱了错误,但我不明白为什么是这样的情况。



有人可以解释并帮助我了解原因和原因, C 或使用 $ 而不是似乎可以解决问题?

解决方案

开普勒/朱诺比较老。我的Luna SR1(使用JBoss Tools)不会给出此错误。一般来说,如果您在JSF文件中遇到虚假的EL验证错误,请尝试在窗口>首选项>Web> JavaServer Faces工具>验证并调整当前(不必要)在错误中设置的某些设置。您的特定问题由应用操作符到方法绑定触发,确实默认为错误。如果将Eclipse升级到最新版本不是一种选择,将其设置回警告应该调低它。



毕竟,EL验证在Eclipse中是一个史无前例的失败。看起来它正在使用正则表达式来验证EL语法,而不是像EL本身正在执行的基于栈的解析器。在类型强制问题和类型分配问题下面有几个条目,这些条目被不必要地设置为错误,并且已知会导致错误错误。



另见:




I have run into a weird situation. I have an application which was originally developed in RAD and uses a construct like rendered="#{alertHandler.showEBox and authenticatedUser.getAccess('acknowledgeAlert')}" />

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

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

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

How can I fix this ?

Update

It seems that if I either change the order of the evaluation to rendered="#{authenticatedUser.getAccess('acknowledgeAlert') and alertHandler.showEBox }" />

or

if I use $ instead of # for the evaluation and keep the original order like rendered="${alertHandler.showEBox and authenticatedUser.getAccess ('acknowledgeAlert')}" />

it seems to get rid of the error, but I do not understand why is that the case.

Can someone please explain and help me understand the cause and the reasons that the change in order of the clauses or the use of $ instead of # seems to fix the problem?

解决方案

Kepler/Juno is relatively old. My Luna SR1 (with JBoss Tools) doesn't give this error.

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

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.

See also:

这篇关于Eclipse错误“无法将表达式运算符应用于方法绑定”在渲染属性中使用AND运算符时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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