It's not a secret anymore!
The moose likes Struts and the fly likes Struts 2 autocompleter not populating from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 autocompleter not populating from database" Watch "Struts 2 autocompleter not populating from database" New topic
Author

Struts 2 autocompleter not populating from database

Pawan Kalyan
Ranch Hand

Joined: Jun 18, 2009
Posts: 34
hi all,

I am trying to use Struts 2 autocompleter tag to auto populate the list of names which i get from Database.
As soon as i am tying a character, its going to action and hitting the database but i am unable to see the data populating as dropdown.

Here's my code:

JSP code:

Action Class Code:

//Getters and setters


struts.xml code:[u][/u]



As soon as i start typing in the textbox , it hits the action class and goes to DB class and gets the arralylist and i am able to see the arraylist size as printout for each char i type in the searchbox of my jsp.
But i am unable to see the dropdown of the data. ( I have a column in DB table which i want to see as dropdown for each char i type)


Please help me where am i going wrong.

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
wib ca
Greenhorn

Joined: Mar 13, 2015
Posts: 1
I know the post is very old but it still shows up on search pages. So for anyone still looking for a solution.

In your xml file the param tag for result type json should return a json string.

"the output of the action must be a well formed JSON string."
https://struts.apache.org/docs/autocompleter.html
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 9138
    
    9

Nice first post. Welcome to CodeRanch.


[How To Ask Questions On JavaRanch]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Struts 2 autocompleter not populating from database
 
It's not a secret anymore!