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 auto suggest in dropdown list using struts/jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "auto suggest in dropdown list using struts/jsp" Watch "auto suggest in dropdown list using struts/jsp" New topic
Author

auto suggest in dropdown list using struts/jsp

Sri haran
Greenhorn

Joined: Jan 07, 2010
Posts: 3

Hi,

Need to have a drop down list with populated values; but when the user wants to select a value, he can either type in the first few letters or select it from the drop down list with the mouse or both.

example: a drop down list has 10 values. the user
clicks on the drop down and it allows him to type in the box or select the value from the drop down, but if he type "A" it will just to all the values starting with "A" and if he continues to type "Al" it will further goto all
the values that start with "Al" e.g. "Alex" and "Albert".

How do i go about doing this using Struts/JSP/Javascript?

Any sample code/example would be great.

Thanks in advance.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Browsers already support that, unless you actually want an Ajaxified version that pulls data from the server side while typing.
Sri haran
Greenhorn

Joined: Jan 07, 2010
Posts: 3
Hi David,
Thanks for the update.
Actually , i'm using Struts 1.1 / Javascript / JSP and the values for the dropdown list are coming from the DB.
So, i need an example for this (not the browser supporting feature).

thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'd just look on the net--the back-end technology isn't really relevant.

I'd *strongly* recommend using a JavaScript library on the client side, though--there's zero reason to do all the Ajax/DOM work manually these days.
Sri haran
Greenhorn

Joined: Jan 07, 2010
Posts: 3
Hi David,
Thanks. yes, you are right, I have to use javascript . Do u've any sample code / link for this?; So, that i can customize to our requirement.

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Search the web--there are a million ways to do this, and thousands of examples.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: auto suggest in dropdown list using struts/jsp