使用HTML和Java创建与Google相同的搜索框

时间:2021-10-27 21:20:37

I am working on a functionality which says, whenever user types a text same employee name, the contents should be suggested in the text box same google does.

我正在研究一种功能,即每当用户键入文本相同的员工姓名时,应该在google所做的文本框中建议内容。

Eg. If the database has values for employeeName say "ravikiran" "ravikant" "ravikrishnan" etc, when the user types "ravi" in the textbox, it should suggest all 3 names and then user can select the option.

例如。如果数据库具有employeeName的值,例如“ravikiran”“ravikant”“ravikrishnan”等,当用户在文本框中键入“ravi”时,它应该建议所有3个名称,然后用户可以选择该选项。

The data that is to be suggested should be queried to oracle database. I am using Java as a backend technology. I understand AJAX can be used to hit the Java code.

应该向oracle数据库查询要建议的数据。我使用Java作为后端技术。我理解AJAX可以用来命中Java代码。

Can you suggest some good tutorials which I can follow in order to achieve the desired functionality!! I searched quite a lot but couldn't find something similar.

您能否提供一些我可以遵循的好教程,以实现所需的功能!我搜索了很多但找不到类似的东西。

3 个解决方案

#1


3  

Use Jquery autocomplete functionality - https://jqueryui.com/autocomplete/ upvote if helped

使用Jquery自动完成功能 - 如果有帮助,请访问https://jqueryui.com/autocomplete/ upvote

#2


1  

What you are looking for is auto-completion. Rather than build it yourself from scratch, I'd suggest finding a Javascript library that can do it for you. For example, I have used jQuery UI's Autocomplete which works well for me.

您正在寻找的是自动完成。我建议你找一个可以为你做的Javascript库,而不是自己从头开始构建它。例如,我使用了jQuery UI的Autocomplete,它对我很有用。

#3


0  

I can recommend the semantic-ui framework with autocomplete. What you need do achieve is, iiuc, exactly as in the example with search autocomplete.

我可以推荐带有自动完成功能的语义ui框架。您需要做的是,iiuc,与搜索自动完成的示例完全相同。

#1


3  

Use Jquery autocomplete functionality - https://jqueryui.com/autocomplete/ upvote if helped

使用Jquery自动完成功能 - 如果有帮助,请访问https://jqueryui.com/autocomplete/ upvote

#2


1  

What you are looking for is auto-completion. Rather than build it yourself from scratch, I'd suggest finding a Javascript library that can do it for you. For example, I have used jQuery UI's Autocomplete which works well for me.

您正在寻找的是自动完成。我建议你找一个可以为你做的Javascript库,而不是自己从头开始构建它。例如,我使用了jQuery UI的Autocomplete,它对我很有用。

#3


0  

I can recommend the semantic-ui framework with autocomplete. What you need do achieve is, iiuc, exactly as in the example with search autocomplete.

我可以推荐带有自动完成功能的语义ui框架。您需要做的是,iiuc,与搜索自动完成的示例完全相同。