Hello folks,
I wanted to use a Struts 2 select in the form. I wanted to populate the list
using filtered collection. If I use it without the filter, like this:
<s:select
name="depzad.dzRequest.contractList[%{#status.index}].selectedContract"
listKey="contractNr" listValue="contractNr"
list="depzad.dzZadostMat.contractList" />
it works just fine. In depzad.dzZadostMat.contractList is a list of the
contracts and contract numbers are in the select.
If I use a filter, that compares a number, it works too:
<s:select
name="depzad.dzRequest.contractList[%{#status.index}].selectedContract"
listKey="contractNr" listValue="contractNr"
list="depzad.dzZadostMat.contractList.{? #this.integerProperty>20}" />
"integerProperty" - there is a valid getter for the integerProperty in the
Contract class and the list I obtain is properly filtered.
However if the property for the filtering is a String:
<s:select
name="depzad.dzRequest.contractList[%{#status.index}].selectedContract"
listKey="contractNr" listValue="contractNr"
list="depzad.dzZadostMat.contractList.{? #this.stringProperty=='B'}" />
I receive an error message:
org.apache.struts2.StrutsException #8636967tag 'select', field 'list', name
'depzad.dzRequest.contractList[1].selectedContract': The requested list key
'depzad.dzRequest.contractList.{?#this.stringProperty=='B'}' could not be
resolved as a collection/array/map/enumeration/iterator type. Example:
people or people.{name} - [unknown location]
The public String getStringProperty() function exists in the Class, but it
is not called. What may be wrong?
--
View this message in context:
http://www.nabble.com/Problem-with-collection-in-select-tp25256112p25256112.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]