My guess is that your single-char string is evaluated as a single char... http://struts.apache.org/2.x/docs/why-wont-the-if-tag-evaluate-a-one-char-string.html
Try flipping the quotes or escaping double-quotes in the expression, then OGNL will probably figure it out. -Wes On Wed, Sep 2, 2009 at 8:00 AM, Mrakomor<mrak...@gmail.com> wrote: > > 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: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org