JSP & Servlet

1 view
Skip to first unread message

ankit nevatia

unread,
Apr 15, 2010, 5:33:37 AM4/15/10
to open-traini...@googlegroups.com
hy,

Can we have autocomplete textbox which reflects data from directly database. I am creating web application.

The reason for this is I want autocomplete component which gets updated automaticly when database is updated.


-Ankit

Urvish Parekh

unread,
Apr 15, 2010, 9:47:01 AM4/15/10
to open-traini...@googlegroups.com
Ya we can...

Shardul Bhatt

unread,
Apr 15, 2010, 9:57:10 AM4/15/10
to open-traini...@googlegroups.com
Urvish,

It would be better if you cold propose a solution.... :)

Shardul.

On Thu, Apr 15, 2010 at 7:17 PM, Urvish Parekh <urvish....@gmail.com> wrote:
Ya we can...

--
You received this message because you are subscribed to the Google
Groups "open-training-community" group.
To post to this group, send email to
open-traini...@googlegroups.com
To unsubscribe from this group, send email to
open-training-com...@googlegroups.com
For more options, visit this group at
http://groups.google.co.in/group/open-training-community?hl=en-GB

ankit nevatia

unread,
Apr 15, 2010, 11:58:21 AM4/15/10
to open-traini...@googlegroups.com
i am with shardul :)

Ritesh Suthar

unread,
Apr 15, 2010, 12:28:02 PM4/15/10
to open-traini...@googlegroups.com
Hi Ankit,

I am a bit confused regarding your requirement.

1. Autocomplete textbox means it starts fetching and displaying data as and when User starts typing characters in the textbox (e.g. Google search field) . This is also referred some times as "Progressive Search"
2. Automatically update of textfield value ( preloaded from existing value) and would want to update is automatically as and when database is updated.

Anyways, for both of the requirement you need to add AJAX capabilities within your web application based on web technology stack you are using at present.

There are readily available rich java script libraries available which you can integrate with your web application and easily achieve the desired behavior.

Regards,
Ritesh 
Regards,
Ritesh
Cell: +919925151637

Urvish Parekh

unread,
Apr 16, 2010, 1:31:33 AM4/16/10
to open-traini...@googlegroups.com
just go through this link i hope it will help you...
http://view.jquery.com/trunk/plugins/autocomplete/demo/

ankit nevatia

unread,
Apr 16, 2010, 8:33:34 AM4/16/10
to open-traini...@googlegroups.com
i am concern with 

1. Autocomplete textbox means it starts fetching and displaying data as and when User starts typing characters in the textbox (e.g. Google search field) . This is also referred some times as "Progressive Search"

but value from database.

Shardul Bhatt

unread,
Apr 16, 2010, 8:45:50 AM4/16/10
to open-traini...@googlegroups.com
The data is fetched from the database..it has to be some kind of a data storage mechanism...so effectively you have to hit the database and search for the word every time the user types a new character....also...you need to ensure that you trigger the search after you notice a pause in typing...else your application would be loaded with frequent search hits...

Usually to avoid performance issues...the search is triggered after user has typed a few characters of the search term.

there are readily available JS to handle this....


Shardul.

Bhushan Parikh

unread,
Apr 16, 2010, 9:03:00 AM4/16/10
to open-traini...@googlegroups.com
Ankit,

I would say, use CACHE. Cache all the data that user might want to search for (Cache have it's own problems too, so keep those in mind). A database trip after every character typed by user would bring in bad performance. Also as suggested by Shardul, use readily available JS (Ajax) for this purpose.

-- Bhushan

ankit nevatia

unread,
Apr 16, 2010, 4:07:15 PM4/16/10
to open-traini...@googlegroups.com
Thanks bhusan for suggestion.

i had done the same thing u said but my problem is if database is updated by new customer or information of customer is edited of deleted then  how refelect that changes in my stored one. I am using Arraylist to store the content currently.

Shardul Bhatt

unread,
Apr 17, 2010, 12:04:28 AM4/17/10
to open-traini...@googlegroups.com
Ankit,

By Caching Bhushan means a caching mechanism like EHCache or OSCache. These mechanisms usually help when you have large databases which are not frequently updated(which say change once a week). You would have to refresh the cache every time you change the database. This is what Bhushan meant when he mentioned the problems related to caching.

Shardul.

Ritesh Suthar

unread,
Apr 17, 2010, 3:09:06 AM4/17/10
to open-traini...@googlegroups.com
You can use polling java scripts on regular interval if you just need to refresh the field with updated value from database. Polling has its own performance impact if you are dealing with heavy data objects/operations.

Regards,
Ritesh
--
Regards,
Ritesh
Cell: +919925151637
Reply all
Reply to author
Forward
0 new messages