【发布时间】:2012-03-18 14:33:22
【问题描述】:
我最近将我的 Web 应用程序升级到 JSF 2.0 (MyFaces 2.0.9) 并使用 tomcat 6(Servlet 2.5 容器)。
以前(在升级到 JSF 2 之前)在 JSP 文件中我有如下声明:
<h:selectOneMenu id="country"
value="#{myBean.countrySelectionControl ? (empty myBean.restrictedCountry ? '' : myBean.restrictedCountry) : myBean.countryCode}"
onchange="submit()"
disabled="#{myBean.countrySelectionControl}">
<f:selectItem itemValue="" itemLabel="------------------Select-----------------" />
<f:selectItem itemValue="here" itemLabel="Here" />
<f:selectItem itemValue="there" itemLabel="There" />
</h:selectOneMenu>
但自从升级以来,此类语句导致错误如下:
错误:org.ajax4jsf.webapp.BaseXMLFilter - 过滤器链中的异常 javax.servlet.ServletException: /jsp/CrudUser.jsp(79,9) '#{myBean.countrySelectionControl ? (empty myBean.restrictedCountry ? '' : myBean.restrictedCountry) : myBean.countryCode}' Set 操作的非法语法
现在我知道我可以将逻辑移回 Backbean,但在此之前,我想检查一下是否还有其他选择,并了解在这种情况下什么是“最佳实践”。
【问题讨论】: