在我的项目中,我们使用 JSF 1.2 和 JBOSS 5 开发了一个项目。作为新要求的一部分,我们必须将其迁移到 Websphere 7。但是我们面临一个问题,我怀疑该问题与内部使用的 java 运行时有关由WAS。它无法自动装箱 int/Integers 、将 Strings 隐式转换为 long 。在为其提供必要的检查后,我最终陷入了以下验证异常:
/Star/employeeFormP1.jsp(226,4) '#{StarEmployeeApplicationFormBean.medicalHMO}' 无法将类“com.idea.app.bean.StarEmployeeApplicationFormBean”上的属性“medicalHMO”设置为值“true”。
相关代码如下:
<h:selectBooleanCheckbox id="checkbox1"
value="#{StarEmployeeApplicationFormBean.medicalHMO}"
title="click it to select or deselect"
immediate="true"
valueChangeListener="#{StarEmployeeApplicationFormBean.listHMOMedProducts}"
onchange="return submit()" />
有人可以帮我解决这个验证异常吗?
最佳答案
JBoss 5 和 WebSphere 7 是 JEE5 服务器,因此 JSF 1.2 impl 将仅使用平台提供的 EL 实现。类型强制的规则详见 the JSP 2.1 spec :
For example, if coercing an int to a String, "box" the int into an Integer and apply the rule for coercing an Integer to a String. Or if coercing a String to a double, apply the rule for coercing a String to a Double, then "unbox" the resulting Double, making sure the resulting Double isn’t actually null.
根据规范中详细说明的规则,这听起来像是 WebSphere 实现中的一个错误。如果您找不到现有的 APAR/Fix Pack解决了这个问题,我会报告它。
关于java - Websphere 7 JSF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1216839/