• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Struts 2 autocompleter not populating from database

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice first post. Welcome to CodeRanch.
 
A feeble attempt to tell you about our stuff that makes us money
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic