jsp - Displaying Map keys on struts2 autocompleter tag -
i've been struggling while autocompleter
tag using struts2 jquery plugin
.
i've been able use on simple way, retrieving string
lists database, wondered if fetch hashmap
action , display user keys only.
the response comming action successfull, can see on chrome dev tools action returning json
containing map
. however, autocompleter displays te values instead of keys, want, i'm trying list addresses user , had used them keys on map
, values identifiers each address.
this example should ilustrate map
looks like. it's response i'm getting action call when user writes 'ho':
{"addresseslist":{"home":"-20","hotel":"-4","hooters":"-2"}}
however, when user starts writing in autocompleter, keeps showing values (-20, -4, -2), not representative user.
i know reverse way , store identifiers keys , addresses' names values, i'm curious , wanted learn how force autocompleter tag show keys instead of map
values. easy way not solution me.
i believe question has more jstl / ognl struts2 tags , find interesting couldn't find googling example on how this.
my autocompleter tag inside jsp
<sj:autocompleter id="addresses" name="selectedaddress" list="addresseslist" href="%{findaddresses}" delay="50" loadminimumcount="2"/>
that addresseslist
hashmap
inside action. tried endless combinations using listvalue
, listkey
properties, setting listkey = addresseslist.keyset()
, things that, sadly none worked out.
Comments
Post a Comment