File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Autocompleter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Autocompleter" Watch "Autocompleter" New topic
Author

Autocompleter

M Marin
Ranch Hand

Joined: Feb 20, 2010
Posts: 32
Hello,

I am building a form to update a database using s:textfield tags in the JSPs. I would like to offer suggestions from the entries already in de Database, like an autocompleter search box, but I would like to know if there is something simpler than the autocompleter with Json format. Is there something quick and easy that I can integrate in my form tags such as the s:textfield and able to offer suggestions from a List of Strings.

Regards.

MR.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What's simpler than JSON? How long is the list of Strings--if it's short, you could just use an immediate list.

But... seriously, it doesn't get much simpler than this.
M Marin
Ranch Hand

Joined: Feb 20, 2010
Posts: 32
I am still considering which strings go into the autosuggest, but I think I would keep it short. Maybe 20, but it could get up to 10000 if the boss want that possibility. What do you mean by immediate list.

Thank you.

MR-
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://struts.apache.org/2.x/docs/autocompleter.html

The "list" attribute...

Useless if you have 10k entries, though.

I'm not really sure what you're comparing its complexity to: an autocompleter is an autocompleter; they all work pretty much the same way.
Sailesh Ganeshan
Greenhorn

Joined: Sep 29, 2010
Posts: 13
hi guys,

Sorry to interrupt. I'd like to use autocompleter, but not sure regarding the JARs that i need to include so that struts recognises the tag. I'm not going to use Dojo plugin, can anyone help me out?


Live your life. Don't just exist.
M Marin
Ranch Hand

Joined: Feb 20, 2010
Posts: 32
As far as I remember, the struts autocompleter uses the dojo plugin and I was passing the values from the DAO using json format. The struts package for the action extends json-default. But please correct me I am wrong.
I added the following jars in my app for the autocompleer.
struts2-json-plugin-2.1.8.1.jar
struts2-dojo-plugin-2.1.8.1.jar
json-lib-2.1.jar

Regards.
Sailesh Ganeshan
Greenhorn

Joined: Sep 29, 2010
Posts: 13
thanks mate!
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
don't forget the struts2 dojo plugin is marked as deprecated.

if you start a new project you should not start with this plugin.
better you code it with plain javascript or use a other plugin like the
struts2 jquery plugin.


My Java and Webprogramming Blog
pooja par
Ranch Hand

Joined: Feb 14, 2011
Posts: 31
Hi all,

Can any one give me an example how autocompleter works with struts2 jquery plugin.
Nowhere I can find the complete example.

addManualIOIManager.jsp:

struts.xml:

AddManualIOIAction actionclass:

whatelse I need to do.
When I type a text in the textbox.. the autocompleter doesn't load any values.

Please tell me where I am going wrong or provide an example

Thanks


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Autocompleter