how can i print my database data in javascript array for autocomplete search box
sanidhya kumar
Greenhorn
Joined: Sep 05, 2012
Posts: 18
posted
0
This is what i am trying, i have created a database in mysql, i have connected it using jsp, and now i want it to display below my auto complete search box
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
First of all you need to add CodeTags around your code, that makes it readable to us.
Second, you have created a database connection inside your jsp. You should not do it. Use MVC for separating your view from your business logic.
Now coming to your problem of using autocomplete feature. You can call a javascript function on a event (say KeyUp) in your view element (which implements the autocomplete feature), then call your data via ajax (assuming you are not using any framework ) and populate your autocomplete div
This is what i am trying, i have created a database in mysql, i have connected it using jsp, and now i want it to display below my auto complete search box
Vishal Shaw
Ranch Hand
Joined: Aug 09, 2012
Posts: 179
posted
0
Sanidhya please read my post
Vishal Shaw wrote: Second, you have created a database connection inside your jsp. You should not do it