• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2 autocompleter

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a problem with an autocomplete field. Unfortunately, I'm starting to use struts right now, but I have to complete this task in a couple of days.
I have a web application based on struts2, with a graphic template based on the bootstrap. For the persistence, the web application uses a mysql database that is accessed through hibernate.
The autocomplete field is a struts tag called sj:autocompleter. The problem is that I am absolutely unable to get it to work! The field should show, as options, a set of strings extracted from the database. How do I launch an action when typing in the field to view the strings extracted from the db? The online examples only talk about json and I am not able to adapt them to my needs. What I have written so far is:

At the moment, the Login action is only a "test action" so it does not return anything, but I don't receive any error message..absolutely nothing happens when I type in the field...no error, no message, nothing...simply, the action is not called.
How can I solve the problem? what should be the action implementation?

Thanks in advance!

P.S. I have correctly imported the struts2 jquery plugin.
 
Salvatore De Giorgi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no one can help me?
I don't know if the question is too complex, unclear or little detailed.
 
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
Please be patient. We are all volunteers here, helping people in our spare time.
I am not well-versed in the jQuery plugin, but if you want to use AJAX to load the selections, I think you will have to use JSON. There is no way to return a Java object like a String array via HTTP without transforming it into plain text.
If you don't require AJAX, this example shows how to use the tag with a plain String array.
 
reply
    Bookmark Topic Watch Topic
  • New Topic