aspose file tools*
The moose likes Struts and the fly likes Struts2 autocompleter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 autocompleter" Watch "Struts2 autocompleter" New topic
Author

Struts2 autocompleter

Salvatore De Giorgi
Greenhorn

Joined: May 13, 2014
Posts: 2
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

Joined: May 13, 2014
Posts: 2
no one can help me?
I don't know if the question is too complex, unclear or little detailed.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

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.


[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 autocompleter