views:

1117

answers:

3

Hi,

In my project we have developed a project using JSF 1.2 and JBOSS 5. As part of new requirement we have to migrate it to Websphere 7. But we are facing a issue which I suspect is related to the java runtime being internally used by WAS. Its not able to autobox int/Integers , cast Strings to long implicitly. After providing the necessary checks for it finally I am stuck at the following validation exception:

/Star/employeeFormP1.jsp(226,4) '#{StarEmployeeApplicationFormBean.medicalHMO}' Can't set property 'medicalHMO' on class 'com.idea.app.bean.StarEmployeeApplicationFormBean' to value 'true'.

The following the relevant code:

   <h:selectBooleanCheckbox id="checkbox1" 
      value="#{StarEmployeeApplicationFormBean.medicalHMO}"
      title="click it to select or deselect"
      immediate="true"
      valueChangeListener="#{StarEmployeeApplicationFormBean.listHMOMedProducts}"
      onchange="return submit()" />

Could anyone please help me on this validation exception?

A: 

I'm not sure exactly what the problem is. I have just a few comments:

  1. "...it's not able to autobox int/Integers..." - Google tells me that WAS 7 uses JDK 5, which does autoboxing. Perhaps you should check to make sure your app server is using the right version of JVM.
  2. "...cast Strings to long implicitly..." - I don't believe any JVM does this.

After providing the necessary checks for it finally I am stuck at the following validation exception:

/Star/employeeFormP1.jsp(226,4) '#{StarEmployeeApplicationFormBean.medicalHMO}' Can't set property 'medicalHMO' on class 'com.idea.app.bean.StarEmployeeApplicationFormBean' to value 'true'.

It's hard to tell without posting some code.

duffymo
I suspect the poster is referring to the platform support for EL type coercion and/or the JSF implementation's internal reflection for doing the same.
McDowell
A: 

WAS 7.0 actually uses JDK 1.6, WAS 6.1 uses JDK 1.5.

Autoboxing works for me, int to Integer etc.

I agree with the comment that String to primitive type conversions are not part of "autoboxing".

The setter for medicalHMO is the key to your problem, what type does it expect?

If for, example, you have setMedicalHMO(string newValue) { ... }

it's might be interesting to add another setter setBooleanMedicalHMO(boolean newValue) { ... }

djna
+1  A: 

JBoss 5 and WebSphere 7 are JEE5 servers, so the JSF 1.2 impl will just be using the EL implementation provided by the platform. The rules for type coercion are detailed in 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.

Based on the rules detailed in the spec, it sounds like a bug in the WebSphere implementation. If you can't find an existing APAR/Fix Pack that addresses the issue, I'd report it.

McDowell