I'm trying to use autocompleter with struts 2.1.2 to replace a select
drop down with too many options, but on submission it seem autocompleter
submits the listValue rather than the listKey. (The same params work
fine with <s:select>, I've had this same issue since 2.0.11.x)

My jsp:

<sx:autocompleter id="auto" label="Group" name="user.group.id" 
value="%{user.group.id}" list="%{#userAction.list}" 
listKey="id"  listValue="name"/>

Html Output:

<select dojoType="struts:ComboBox" id="auto" name="user.group.id"
keyName="user.group.idKey" visibleDownArrow="true"
onblur="validate(this);">
    <option value="1">Group1</option>
    <option value="2">Group2</option>
    <option value="3">Group3</option>
    ...
  </select>  



When I submit the form I get this exception:

Unparseable number: "Group1" at position 0 - [unknown location]
        at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.doConvertToN
umber(XWorkBasicConverter.java:411)
...
at java.lang.Thread.run(Thread.java:595)
ognl.MethodFailedException: Method "setId" failed for object
[EMAIL PROTECTED]
[java.lang.NoSuchMethodException: setId([Ljava.lang.String;)]



If I change the autocompleter parameters a little and swap
listKey/listValue, I can get the form to submit fine, but I only see the
id's in the drop down box, not the group names, like so:

<sx:autocompleter id="auto" label="Group" name="user.group.id" 
value="%{user.group.id}" list="%{#userAction.list}" 
listKey="name"  listValue="id"/>

HTML Output:

<select dojoType="struts:ComboBox" id="auto" name="user.group.id"
keyName="user.group.idKey" visibleDownArrow="true"
onblur="validate(this);">
    <option value="Group1">1</option>
    <option value="Group2">2</option>
    <option value="Group3">3</option>
    ...
  </select>  


My first assumption is to assume I'm doing something wrong (9 times out
of ten that's the reality :-). All the examples I've seen only use
simple text value submits to Strings in the action, but I'm trying to
populate a pojo which is property of a pojo (user.group.id) so I'm not
sure if under these circumstances I might need to do something else.

Does anyone know if there's anything I can do about this? Is it a bug?
Or am I doing something wrong? I've tried a lot of other combinations of
options but to no avail.


You guys are doing a cracking job, keep up the good work!
----------------------------------------------------------
This transmission is strictly confidential, possibly legally privileged, and 
intended solely for the 
addressee.  Any views or opinions expressed within it are those of the author 
and do not necessarily 
represent those of 192.com, i-CD Publishing (UK) Ltd or any of it's subsidiary 
companies.  If you 
are not the intended recipient then you must not disclose, copy or take any 
action in reliance of this 
transmission. If you have received this transmission in error, please notify 
the sender as soon as 
possible.  No employee or agent is authorised to conclude any binding agreement 
on behalf of 
i-CD Publishing (UK) Ltd with another party by email without express written 
confirmation by an 
authorised employee of the Company. http://www.192.com (Tel: 08000 192 192).  
i-CD Publishing (UK) Ltd 
is incorporated in England and Wales, company number 3148549, VAT No. GB 
673128728.

Reply via email to