Originally posted by B T R Srinivasarao:
I am unable to add dataFieldName attribute for autocompleter in struts2.0.6
and able to get the attribute in struts2.0.9
was the release having some issues in 2.0.6?
Originally posted by Merrill Higginson:
To be honest, I've never used the Struts autocompleter tag, so I'm learning along with you. I did spend some time and got an example working, but I did it differently that you did.
I'll share my code with you, and hopefully you'll be able to get it working also. I just took the existing code from the struts2-showcase application and modified it so that rather than using the static JSONList.js file, it uses an Action class to generate the output.
The first thing I did was download the jsonplugin-0.30.jar file from this link and put it in my WEB-INF/lib folder.
Here's the modifications I made to the struts-ajax.xml file:
I then created the following Action class:
In the index.jsp, all I had to do was add dataFieldName="states" to each of the <s:autocompleter> tags.
Once I did this, the tags work exactly the way they did with the static list.