I have a JSF hidden input on my app view that holds some object's attribute:
<h:inputHidden id="hidMyData" value="#{bean.myList.get(bean.listIndex).someAttr}" immediate="true"/>
Index that determines the right object, is also saved in session bean and is an integer:
public void setListIndex(int listIndex) {
this.listIndex = listIndex;
}
public int getListIndex() {
return listIndex;
}
If I run my app on Websphere Application Server 8.5.5, I'm getting a conversion error:
PrimeExceptio E /pages/MyView.xhtml at line 566 and column 50 value="#{bean.myList.get(bean.listIndex).someAttr}": Cannot convert get of type class java.lang.String to class java.lang.Integer
At the same time if I run it as a portlet on IBM Portal 7, there's no error. In both cases I use MyFaces implementation version 2.0.17 and Primefaces 6.2.27.
What could cause this error?
EDIT1: Just realized that using square brackets instead of get
method works fine:
<h:inputHidden id="hidMyData" value="#{bean.myList[bean.listIndex].someAttr}" immediate="true"/>
Anyway if someone has an explanation why this method works and the first one doesn't, I'll appreciate it.