Autocomplete Textbox in JSP
November 11, 2010 176 Comments
Autocomplete plugin for jQuery can be used to provides list of suggestions, as we type letter/s in our textbox.
Last few days I was breaking my head for auto complete textbox in JSP with autocomplete (v1.3) jQuery plugin. I had tried all the way, but I was not getting the list on the textbox. Even I posted the problem in DaniWeb, discussion community, but there also I didn’t get any solution.
Later after long try I found the solution. Actually autocomplete v1.1 works with JSP very well, but earlier is not working with JSP. With v1.1, I got output in this way.
For the given example, I have created a JSP file which will contain a list of country name. If you want to create the list with the data of the database, you will need to select the data from the database and print the data in JSP page with new line after each data.
//list.jsp <%@page import="java.util.Iterator"%> <%@page import="java.util.List"%> <%@page import="java.util.ArrayList"%> <% String countries[] = { "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", . . "Yemen", "Zambia", "Zimbabwe" }; String query = (String)request.getParameter("q"); //System.out.println("1"+request.getParameterNames().nextElement()); response.setHeader("Content-Type", "text/html"); int cnt=1; for(int i=0;i<countries.length;i++) { if(countries[i].toUpperCase().startsWith(query.toUpperCase())) { out.print(countries[i]+"\n"); if(cnt>=10) break; cnt++; } } %>
Then we have a JSP or HTML page which will request to the server side page autocomplete function of autocomplete plugin.
//index.jsp <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="JS/jquery-1.4.2.min.js"></script> <script src="JS/jquery.autocomplete.js"></script> </head> <body> <div style="width: 300px; margin: 50px auto;"> <b>Country</b> : <input type="text" id="country" name="country" class="input_text"/> </div> </body> <script> jQuery(function(){ $("#country").autocomplete("list.jsp"); }); </script> </html>
I have used the following styles to make it suitable for my site. You can modify according to your requirements.
.ac_results { padding: 0px; border: 1px solid #ff7c08; background-color: white; overflow: hidden; } .ac_results ul { width: 100%; list-style-position: outside; list-style: none; padding: 0; margin: 0; } .ac_results li { margin: 0px; padding: 2px 5px; cursor: default; display: block; color: #972800; font-family:Arial, Helvetica, sans-serif; /* if width will be 100% horizontal scrollbar will apear when scroll mode will be used */ /*width: 100%;*/ font-size: 12px; /* it is very important, if line-height not setted or setted in relative units scroll will be broken in firefox */ line-height: 16px; overflow: hidden; } .ac_loading { background: white url(../images/indicator.gif) right center no-repeat; } .ac_odd { background-color: #fef2d8; } .ac_over { background-color: #febb80; color: white; } .input_text{ font-family:Arial, Helvetica, sans-serif; font-size:12px; border:1px solid #FF7C08; padding:2px; width:150px; color:#802900; background:white url(../images/search.png) no-repeat 3px 2px; padding-left:17px; }
Source files are available here.
Some extra features could be possible from earlier version of autocomplete, So if anyone find the solution in newer vision, please do comment me.
Good day I was luck to seek your topic in baidu
your subject is superb
I get much in your theme really thank your very much
btw the theme of you blog is really wonderful
where can find it
Hi,
i’m not much familiar with jquery could u pls send me the code where i can get the values from database
I would like to suggest you to download my project from the above link.
Then in list.jsp, select the data according to received parameter using like operator of SQL
and print those selected data using loop.
I hope you can do it now.
Hi Prashant,
I tried ur code , but it’s not working in my system. I’m using IE 8 and i’m not able to understand the jquery code, pls help me.
does my demo link worked in ur browser??
yes
yes, it’s working . when i used your code in my application it;s not working
Okay.. Let me tell you procedure..
1) create JS folder in your application
2) inside that folder paste jquery.autocomplete.js and jquery-1.4.2.min.js
3) link js files from index.jsp(the file in which you want to insert auto textbox)
4) in list.jsp (to display list from db) write code to print all list of data
5) in index.jsp (auto textbox file) assign the list.jsp url in javascript autocomplete function
jQuery(function(){
$("#country").autocomplete("list.jsp");
});
send ur code
Hi,
i’m not much familiar with jquery could u pls send me the code where i can get the values from database through auto complete.
i’m doing on Struts1.0 .
Hi,
i am trying to make a link between a list entry and to a text box…using jsp , javabean ,mysql and javaScript ..My Q is: I have a drpdownlist, textbox and search button.
suppose there are some 3/4 entries in a dropdown list.If i select an entry from the list and give a related data(suppose in list i select TITLE and in text box i entered atomic……)so when i click search button it should show me all the entris related to letter starts with ato………………
Plz give me some idea.I know how to retrieve set of related entries from the database using the JSP.
Hello nikki,
I think for this you have to first take take beginning three letters from the textbox field.
and then that letters you can use in sql query with Like clause.
so you will get all those value from the table data which begins from those substrings.
something like this:
str=textbox_string.substring(0, 2);
query=”SELECT FROM `database`.`table` where field like ‘”+ str+”%'”;
Thanks for your reply.I did the above query and also got the result.But can i know how will i make a link between a dropdown list and text box ,so that when i search i will get the list of titles related to the subject chosen from list ?
Welcome nikki,
To send multiple value in autocomplete, we have to add an extra parameter to autocomplete function call.
in my above example if you have a bropdown named dropdown_name, then the changes in autocomplete function call will goes like this :
$(“#country”).autocomplete(“list.jsp”,{extraParams: { active : function() { return $(‘input[name=dropdown_name]’).val(); }} });
and in JSP page you can get a request parameter as ‘active’
combo=(String)request.getParameter(“active”);
now you can use combo with query with AND clause.
ok,
i will try.Thanks again.
Thank you, I was in search of such a solution for so long.
Awesome post, works like a dream and i have learnt so much thankyou
Hi Prashant,
I tried your code with SQL statement with the LIKE in the list.jsp page, but it is not working. And the didnt find the jquery-1.4.2.min.js file in the code I downloaded. But i downloaded it from somewhere else. Can u explain for what is the jquery-1.4.2.min.js used for. It will helpful if u provide a example for autocomplete with database.
Thanks & Regard’s
Saranya Jayaram
Hi Prashant,
I found the jquery-1.4.2.min.js file. Didnt check it properly earlier..
Regard’s
Saranya Jayaram
That is good Jayaram… you can download my example from the link given at the bottom of the post.
HI PRASANTH,
I HAVE TRIED U R EXAMPLE WHICH IS REALLY VERY NICE IN U R DEMO BUT IT IS NOT WORKING IN MY SIDE , I HV TRIED U R SUJJESTION ALSO 1) create JS folder in your application
2) inside that folder paste jquery.autocomplete.js and jquery-1.4.2.min.js
3) link js files from index.jsp(the file in which you want to insert auto textbox)
4) in list.jsp (to display list from db) write code to print all list of data
5) in index.jsp (auto textbox file) assign the list.jsp url in javascript autocomplete function
jQuery(function(){
$(“#country”).autocomplete(“list.jsp”);
});
BUT STILL AM NOT GETTING ANY RESULT IN MY COUNTRY TEXT BOX
FILES USED:index.jsp……….jquery-1.4.2.min.js………jquery.autocomplete.js………list.jsp……..style.css IS AM MISSING ANY HTING HERE PLEASE FIGURE IT OUT ITS VERY URGENT REQUIREMENT TO ME PLEASE REPLY BACK
Hi Vijay,
As you have told me, you have did everything correctly.
I would like to suggest few issues that you should take care of
1) the string you sent from index can be receive as (String)request.getParameter(“q”); in list.jsp
2)Compare the folder and files placements. like .js files into JS directory, .css files into css directory etc.
3)Jquery Script should be after the creation of the textbox.
I hope this may help you. Once I suggest you to download my example and run it in your system.
otherwise please send me your both JSP file. I hope i can check something in that.
hi prasant,
still it is not displaying any thing as per u r suggestion i hv placed 2 js files in js folder 1.jquery-1.4.2.min.js ……2.jquery.autocomplete.js and another one in css folder ie style.css file
and 2 jsp files code is index.jsp
Count :
jQuery(function(){
$(“#country”).autocomplete(“list.jsp”);
});
and list.jsp
please once download my example and run it.
hi prasant,
still it is not displaying any thing as per u r suggestion i hv placed 2 js files in js folder 1.jquery-1.4.2.min.js ……2.jquery.autocomplete.js and another one in css folder ie style.css file
and 2 jsp files code is index.jsp
Count :
jQuery(function(){
$(“#country”).autocomplete(“list.jsp”);
});
and list.jsp
<%
String countries[] = {
"Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Yemen",
"Zambia",
"Zimbabwe"
};
String query = (String)request.getParameter("q");
System.out.println("1"+request.getParameterNames().nextElement());
response.setHeader("Content-Type", "text/html");
int cnt=1;
for(int i=0;i=10)
break;
cnt++;
}
}
%>
index.jsp
Count :
jQuery(function(){
$(“#country”).autocomplete(“list.jsp”);
});
that piece of code will be inside javascript tag after the creation of textbox.
jQuery(function(){
$("#country").autocomplete("list.jsp");
});
Hi,
if i want to retrive jsp page from another instance, what i have to do,please give detalis,the will one is useful for list.jsp in ourcontextroot, suppose if i am in another contextroot, but i want access the list.jsp , what i have to do , give me any suggestions
$(“#country”).autocomplete(“list.jsp”);
once try to send the instance along with url
list.jsp?value=
I hope this may work.
yes it is inside only but is not displaying here i will try once again to paste it
—
jQuery(function(){
$(“#country”).autocomplete(“list.jsp”);
});
—
can you send me both JSP file.. if there is database detail you can remove it
yes i can but here i dnt have any attachments already i hv posted list.jsp code and i was tried to paste index .jsp but it is displaying only that jquery function , can u suggest me how can i send that files
and thanks for u r great response
attach n send me to my email, yohoprashant@yahoo.com
from my company id i dnt have access to send this files give me a 5 minutes i will send this from my personal id vijaybrathode@yahoo.com ,i will send u hole folder please check that it is very urgent for me but please reply here itself
ok Vijay
please check u r id i hv sent one zip file vijaybrathode@yahoo.com is my personal id u can send files here
hai prasant
did u get my mail is i made any mistake in this flow
thanks a lot prashant its working fine yes it is working in 1.1 version because in this they added
* Added matchContains: “word” option, match only the start of words instead of everywhere
* Fixed mustMatch to trigger result event when no match was found
* Fixed the issue where an autocomplete was applied after the field had focus
* Extended multiple complete to enable editing words not at the end of the field (doesn’t work in Opera)
once again thanks a lot
now am trying to connect with my database
Hi Prashant,
I downloaded ur code and ran it eclipse but it was not working, then later I added the JSF capabilities in eclipse ur application worked fine. So i did the same with my project with database but again still it is not working. please help me it is very urgent..
Thanks & Regard’s
Saranya Jayaram
Hello Saranya,
I think you are mistaken, while creating list. you don’t need to add any JSF capabilities.
first just try with run the downloaded project. if it does not run then i have to look after it.
hi saranya jayaram can u send me list.jsp code
hi saranya jayaram can u send me list.jsp cod
Hi Vijay,
Do you need the list.jsp page with database? But it is not working for me also..
Regard’s
Saranya
saranya jayaram send me that code i will check once,paste it here
Hi Vijay,
here is the code..
where is the code u dint pasted it
Vijay,
I pasted it below.
saranya jayaram
am not getting ur code it is not displaying can u send me to this id
prasad.shankarnarayana@asia.xchanging.com
vijaybrathode@yahoo.com
Hi Vijay,
Is ur list.jsp with database working fine?
am not getting ur code it is not displaying can u send me to this id
prasad.shankarnarayana@asia.xchanging.com
vijaybrathode@yahoo.com
<%
//out.print("”+strAssigneeName+””);
}
}
}
catch(Exception e)
{
out.println(e);
}
%>
hi prashant i need your help
how to access two values in two different text box
am able to display employee name from my database is there way to display corresponding employee id in other text box
Hi Vijay,
Here is an example, In this i have tried to link between country and state.
Please download the zip and check, whether it will work for you or not.
link : http://www.4shared.com/file/_ILLR4wc/auto_complete_2.html
Can u please send me that zip to my id
please send me am hardly struggling with this from last few days
hi prasant
thanks for your help i’ts working on my system it’s so helpful for me once again thanks for u……..
hi saranya jayaram this is the code i used to fetch value from database
<%
//out.print("”+strAssigneeName+””);
}
}
}
catch(Exception e)
{
out.println(e);
}
%>
Hi Prashant,
I just want to know whether there is any criteria that jquery works only in dynamic web project in eclipse. Or it works in a java project also in eclipse.
With Regard’s
Saranya Jayaram
Hi Saranya,
Actually JQuery is a Web UI plugin. It may work with any web application that opens in browser.
But not the stand alone project Like J2SE(AWT, SWING).
Hi Prashanth,
I am looking for a solution for autocomplete with jquery, with struts 1.1.
Can you please send me the code, i am unable to download it from the link given.
Thanks,
Divya
Hi Prashant thanks for all your code i want to display an autocomplete listbox values from DB
pls suggest me the code.
I have posted a suggestion to Mohammed on the comment list. Once try to follow it, I hope it may help you.
otherwise write me where you are facing problem.
Hey guys…please thank prashant sir for his extreme support to beginners like us….Thank you prashant sir!! great work…thanks for your support…keep helping us!!! 🙂 thanks a lot!!
thank you Niket for such a great comment.. by the way, Sir is too much for me.. I am just another student like you.
your blog helped me alot!! keep posting..i’ve learnt very much from this blog….thanks 🙂 -niket
You are very much welcome, niket. I am really very happy that my post is helping someone to learn..
Sir,
i’m trying to develop a software which generally any shop keeper will use for the sake of billing in which we can get product name from the database and along with it he must be able to enter the quantity and amount of that product and later generate the bill/report for customer…can i get any reference which would help me doing the same…please help…i want to learn it..
Hello niket,
First of all plz dont call me sir.. I am just a student like you.
And about your project, Which technology you want to implement in that project.J2EE or J2SE.
If you are confirm with the technology and the language, I will try to find some resource for you.
hello prashant,
am very new to jsp and javascript….could u plis explain to me expilicitly on how I can edit this code so that I get the data from postgresql database….I know this is too much but I’ll appreciate your help..you can email me at kamjugu@gmail.com
hi prasanth
My name is Hemanand… just i need ur help do u have any idea about Hibernate framework.. if u having means plz help me…
I am waiting ur reply…
Thanks & Regards
Hemanand
Hi Hemanand,
Hibernate will be more easier in myeclipse. So i would like to suggest you to start hibernate in it.
and about learning, I think this link will be very much useful tutorial for the beginner.
If you get any problem, feel free to write.
Hi prashanth,
i am new one for jquery…. i am following ur guidelines to develop auto complete feature…
My requirement is i have one drop down box and one text field in my jsp page… if i change any thing in my drop down box… the corresponding names will be displayed in text field …
if i used ur hart coded values then functionality is working fine… with database i am not able to getting this functionality..
i am giving some code to u based on this one i hope u can help me…
function keyUp1()
{
var formObj = window.document.forms[0];
var query = formObj.regionName.value;
// alert(“query: “+query);
<%– var query = –%>
//System.out.println(“1″+request.getParameterNames().nextElement());
var cnt=1;
for(var i=0;i=10)
break;
cnt = cnt+1;
}
}
}
here i am getting these two alerts alert(“query: “+query); and alert(“temp1[i]: “+temp1[i]);
suppose if i enter ‘a’ in text field … i am getting ‘a’ for this alert alert(“query: “+query);
and Africa
Antarctica
Asia
Australia for this alert alert(“temp1[i]: “+temp1[i]);
But still i am not getting auto complete feature which is shown in ur demo part….
can u help ASAP….
thanks,
raj
Hello Raj,
Which version of Jquery you are using?
Hello Prashanth,
I am using Jquery v1.6.2 and one more thing i am using this statement
instead of taking tag for country….
after that i am giving this statement
jQuery(function(){
/* $(“#regionName”).autocomplete(regionTypeList()); */
$(“#regionName”).autocomplete(“Resources/jsp/ManageAsset/region.jsp”);
regionTypeList();
});
if u wanna check my flow… give me ur gmail Id… i will send required files…
Please use JQuery v1.1, it will only work with jsp.
hi Prashant,
i try ur code, but it didnt get worked..
I follow ur Steps wch u said earlier, but didnt get Output which i want..
Please help m…
Thanks in advance
Hello Kapil,
are you using JQuery v1.1?
yes i use JQuery v1.1
Problem has been solve…
its a silly mistake from my side…
String query = (String)request.getParameter(“q”);
can anyone explain meaning of above line we sending parameter as “q”…
but getParameter function is receives id of textbox or label???
thanks in advance..
its a query string that is passed by jquery while making ajax request.
Thanks for your help ..
I done the autocomplete thing after struggling 2 days…
Here is the code i am attaching
It isworking fine from fetching databse values
list.jsp
<%
response.setContentType("text/html");
int i=0;
String str=request.getParameter("q");
String countries[]=new String[15];
System.out.println("String:::::::::"+str);
try {
String connectionURL = "jdbc:mysql://localhost:3306/project";
Connection con;
Class.forName("com.mysql.jdbc.Driver");
// Get a Connection to the database
con = DriverManager.getConnection(connectionURL, "root", "zeta");
//Add the data into the database
String sql = "SELECT prnam FROM acustomer WHERE prnam LIKE '"+str+"%' LIMIT 10";
Statement stm = con.createStatement();
stm.executeQuery(sql);
ResultSet rs= stm.getResultSet();
HashMap a1=new HashMap();
while (rs.next ())
{
a1.put(++i,rs.getString("prnam"));
}
for(int j=1;j<=i;j++)
{
String x=a1.get(j).toString();
countries[j] = x;
System.out.println("hello"+countries[j]);
}
/*for(int j=1;i<=i;j++)
{
System.out.println("hello"+countries[j]);
}*/
response.setHeader("Content-Type", "text/html");
int cnt=1;
for(int j=0;i=10)
break;
cnt++;
}
}
}
catch(Exception e){
out.println(“Exception is ;”+e);
}
%>
auto.html
Country :
jQuery(function(){
$(“#country”).autocomplete(“list.jsp”);
});
you need download jquery libraries
regards
prudvi raju
which version of JQuery you are using?
for (int j = 1; j <= i; j++)
{
String x =(String) iter.next().toString();
a[j] = x;
out.println("hello" + a[j]);
}
i m getting error at line : String x =(String) iter.next().toString();
Error is : An exception occurred processing JSP page /list.jsp
iter is Iterator.
Iterator having data of arraylist..
can anyone help m???
Thanks in advance
Here is my List.jsp code :
<%
//String query = "9";//(String)request.getParameter("q");
//System.out.println("1"+request.getParameterNames().nextElement());
response.setHeader("Content-Type", "text/html");
String name = null;
name = "s";//(String) request.getParameter("q").trim();
String a[] = new String[100];
ArrayList b = new ArrayList();
//out.print(name);
Connection connection;
Statement stmt = null;
ResultSet rs = null;
int cnt=0,i = 0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:ds", "sa", "gtssa@1234");
stmt = connection.createStatement();
rs = stmt.executeQuery("Select airline_name From airline_master ");
Iterator iter = b.iterator();
while (rs.next())
{
b.add( rs.getString(1));
i++;
}
for (int j = 1; j
Thanks in advance
Better you send me the source files to my mail.
Hey again sory ,
but my Problem has been solved…
dere is one question in my mind ,
can we write code into servlet rather then jsp page…
i tried from my side , but i didnt get output any output..
Thanks in advance
please once check the Servlet from the browser by sending the the query string in url.
if it works fine in browser, I think it should work with autocomplete too.
my doubt is while using Servlet-Jsp or servlet-HTML,
on click of Submit button on HTML or JSP page our request is send to Servlet…
but in this case on the typing on textbox our Servlet hav 2 get called…
i think its not possible in this senerio..
if anyone had idea please share it…
Thanks in Advance…
it is possible…just include the list.jsp code in servlet…and while calling give the path of the servlet instead of jsp.it works.
Thanks a lot…!!!!!u made my day..! just implemented the same using MVC .n it works well 🙂
hey congrats !!!
can u tell m in brief wat u have done in MVC pattern???
because in my senerio there are 2 auto complete textbox,
but dey vll not called at same time in same list.jsp page.
i try for servlet but it didnt get work…
Thanks in advance…..
Hi,
how to implement countries flag image in corresponding list through this.
save country flags according to the ID of the country. then whatever country is there, display along with image(<img src="images/.jpg”/>)
Hi,
Where i have to make changes to display images.
hi,
is it possible to get the values in the same jsp page ie (calling on the same page and getting the values on the same page itself)?? am getting the entire jsp page in the text box instead of the values..
Thanks in advance..
Obviously it will return you the whole content of the site. Better you use simple javascript for that.
Hi,
Can i use your script in other language ?
I want to use it in Thai .
Thank in advance.
Yes martin, you can use this script for other language too..
for PHP you can get more effective autocompletes.
hi,
am new in jsp…could you please send me the jsp codings for autocomplete textbox for selecting places .
Hi Ansu,
You can download the code from the link given at the bottom of the post.
Hi,
Sry….i want the same codings for retreiving the datas from the database……plz send me the reply for this…its urgent.
Please follow this code… it will be more similar to this http://www.roseindia.net/answers/viewqa/Java-Beginners/9452-jsp-list-box.html
________________________________
Hi Prashant,
Thanks…..I got it…
i want to insert username and image into database ,this is my code.i cant able to retrive upload images from database.if i will give select image from file where id=1.;it will diSplay image.but if i upload another image it will dispaly the same wheather i gave id=1.i want to retrieve newly uploaded image.SELECT IMAGE FROM FILE WHERE ID=”+ID+”;
String username=request.getParameter(“username”);
//out.println(username);
String contentType = request.getContentType();
if ((contentType != null) && (contentType.indexOf(“multipart/form-data”) >= 0))
{out.println(“username”);
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead You have successfully upload the file by the name of:
0){
System.out.println(“Uploaded successfully !”);
}
else{
System.out.println(“Error!”);
}
}
catch(Exception e){e.printStackTrace();}
%>
<%
try
{
//Retrieve the id of the product selected by the user
//the product id is sent via the URL as a parameter
int id = -1;
String strid = request.getParameter("id");
if(strid != null) {
//Convert from string to int
id = Integer.parseInt(strid);
}
//Load the database driver
Class.forName("com.mysql.jdbc.Driver");
//Create a connection to our database
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/datas", "root", "");
//create an SQL statement
PreparedStatement ps = con.prepareStatement("SELECT * FROM rows WHERE id=?");
//set the ID to be the id above
ps.setInt(1, id);
//Execute and retrieve our result
ResultSet rs1 = ps.executeQuery();
if(rs1.next()){
String imgLen = rs1.getString(1);
int len = imgLen.length();
byte [] rb = new byte[len];
InputStream is = rs.getBinaryStream(1);
int index=is.read(rb, 0, len);
rs.close();
response.reset();
response.setContentType("image/jpg");
response.getOutputStream().write(rb,0,len);
response.getOutputStream().flush();
}
}
catch (Exception e){
e.printStackTrace();
}
}
what is the mistake here,plz help me
i want to retrieve images from database when i upload from some where.how can i do
HI PRASANTH I want to retrive uploadedimages using jsp with mysql .could u plz send the code for inserting and retrivinguploading images
hai prasanth i need ur help plz.can u sen me the code image uploading in jsp with mysql.actually i tried this code
= 0))
{out.println(“username”);
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead You have successfully upload the file by the name of:
0){
System.out.println(“Uploaded successfully !”);
}
else{
System.out.println(“Error!”);
}
}
catch(Exception e){e.printStackTrace();}
%>
this code is not working properly.in the retrieval part i used the code select images from rows whrer id=5″.in this way the images are displaying.but i want the code related to uploaded image.when i upload the image it can display without using id=3.PLZ HELP ME.
Once please try with Jakarta Fileupload library.
I think, that will be the easier one.
You should visit these link, it may help you.
http://www.roseindia.net/servlets/upload-image.shtml
http://www.kodejava.org/browse/55.html
http://www.servletworld.com/servlet-tutorials/servlet-file-upload-example.html
actually that site is used to insert the image but i want to retrive image in jsp with mysql.could u plz send the code fir retieve image from mysql in jsp codeor any sites .
= 0))
{out.println(“username”);
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead You have successfully upload the file by the name of:
0){
System.out.println(“Uploaded successfully !”);
}
else{
System.out.println(“Error!”);
}
}
catch(Exception e){e.printStackTrace();}
%>
could u plz send the retriving the image uploading from database in JSP WITH MYSQL.
PLZ HELP ME
SELECT IMAGES FROM ROWS WHERE ID=1″.i tried this query but it shows the image when i give no id=1.but i want to retrive the uploaded image.plz help me
could u plz send the retrival images from mysql using jspcode.
first i upload the image it will insert into mysql using insert query and i wnt to retrieve images from mysql.SELECT IMAGES FROM tablename WHERE ID=1″.i tried this query.but it shows the when i give id=1 or some number.
I WANT TO retrieve the image from mysql without using id.
PLZ HELP ME.
how to retrieve image from mysql.
how to retrieve the uploaded image without specyfying the path and id no in jsp with mysql.
i wnt to retrieve the image by using the select query where id=”id without specyfying the number.
plz help me.could u plz send ot the code in jsp with mysql for retrieving the image without specyfying the path and id no.i wnt retrieve the uploaded image when id=”id;.
Sorry Dhanesh,
I do not have any solution for this.. for me to retrieve single row or single data from database, we must have an unique field in where clause.
Hi Prashanth,
i want the codings for star rating to update and display from database…….please help me …..its very urgent…………………
Hi Mithu,
I have not yet implemented JSP star ratting yet. But please try to download from this URL,
http://www.hscripts.com/scripts/jsp/star-rating.php
I hope this could help you.
thanks for ur help it’s so helpful for me thanks once again prashant
Hi,
I want codings in jsp………..
Hi,
In Jsp
Javascript
//Gets the browser specific XmlHttpRequest Object
function getXmlHttpRequestObject() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject(“Microsoft.XMLHTTP”);
} else {
alert(“Your Browser Sucks!\nIt’s about time to upgrade don’t you think?”);
}
}
// Our XmlHttpRequest object to get the auto suggest
var searchReq = getXmlHttpRequestObject();
var divPosition = 0;
var divMaxPosition = -1;
var prevPositoin = 0;
var currentdivName = null;
document.onclick=function hanldeClick(){
try{
if(currentdivName!=null)
document.getElementById(currentdivName).innerHTML=”;
document.getElementById(currentdivName).className = “noBorderClass”;
divPosition = 0;
divMaxPosition = -1;
prevPositoin = 0;
currentdivName = null;
}catch (e) {}
}
// Called from keyup on the search textbox.
// Starts the AJAX request.
function searchSuggest(event, searchTextName, divName) {
// alert(event.keyCode+” “+searchTextName+” “+divName);
currentdivName=divName;
if (event.keyCode == 40) {
// suggestOut(null,”down”);
suggestOver(null, “down”, divName);
return;
}
if (event.keyCode == 38) {
// suggestOut(null,”up”);
suggestOver(null, “up”, divName);
return;
}
if (event.keyCode == 13) {
if (divMaxPosition > 0 && divPosition > 0)
setSearch(document.getElementById(divName+”_”+divPosition).innerHTML,searchTextName, divName);
return;
}
if (searchReq.readyState == 4 || searchReq.readyState == 0) {
var searchText = escape(splitTextAfter(document.getElementById(searchTextName).value));
//alert(searchText+” “+searchTextName)
//fieldname=searchTextName;
searchReq.open(“GET”, ‘searchSuggest?search=’ + searchText + ‘&fieldname=’ +searchTextName, true);
searchReq.onreadystatechange = function handleSearchSuggest() {
if (searchReq.readyState == 4) {
var ss = document.getElementById(divName);
ss.innerHTML = ”;
var str = searchReq.responseText.split(“\n”);
if (str.length > 1)
ss.className = “borderClass”;
else
ss.className = “noBorderClass”;
divMaxPosition = str.length – 1;
divPosition = 0;
prevPositoin = 0;
// alert(divMaxPosition+”loop”);
for (i = 0; i < str.length – 1; i++) {
var suggest = '’ + str[i] + ”;
ss.innerHTML += suggest;
}
}
}
searchReq.send(null);
}
}
// Called when the AJAX response is returned.
// Mouse over function
function suggestOver(div_value, eventId, divName) {
try {
// alert(divMaxPosition+””+divPosition)
if (divMaxPosition > 0) {
if (eventId == “down”) {
if (divPosition divMaxPosition – 1)
divPosition = 1;
else
divPosition++;
div_value = document
.getElementById(divName + “_” + divPosition);
}
if (eventId == “up”) {
// alert(divPosition+” u “+divMaxPosition);
if (divPosition 0)
suggestOut(document
.getElementById(divName + “_” + prevPositoin));
// alert(div_value.id)
try{
div_value.className = ‘suggest_link_over’;
}catch(ex){}
divId = div_value.id;
prevPositoin = divId.substring(divId.lastIndexOf(“_”) + 1,
divId.length);
divPosition = prevPositoin;
}
} catch (e) {
}
}
// Mouse out function
function suggestOut(div_value) {
try{
div_value.className = ‘suggest_link’;
}catch (e) {}
}
// Click function
function setSearch(value, searchTextName, divName) {
searchTextRef = document.getElementById(searchTextName);
searchTextRef.value = splitTextBefore(searchTextRef.value) + value + “,”;
document.getElementById(divName).innerHTML = ”;
document.getElementById(divName).className = “noBorderClass”;
}
function splitTextBefore(totalText) {
return totalText.substring(0, totalText.lastIndexOf(“,”) + 1);
}
function splitTextAfter(totalText) {
return totalText
.substring(totalText.lastIndexOf(“,”) + 1, totalText.length);
}
searchSuggest.java
String searchText = request.getParameter(“search”);
String fieldname=request.getParameter(“fieldname”);
if(fieldname.equals(“country”)){
preparedStatement = connection.prepareStatement(“Select DISTINCT TOP(10) COUNTRY from DOCUMENT_LOCATION where COUNTRY like ?”);
preparedStatement.setString(1,searchText+”%”);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
buffer.append(resultSet.getString(“COUNTRY”));
buffer.append(“\n”);
}
resultSet.close();
preparedStatement.close();
}
I hope this may help you.
hai prasanth,thanks
i have another doubt
this is my table structure.i want to insert image logo and ROUTEMAP with text in mysql.how can do that.u have any idea.PLZ TELL ME THE ROUTEMAP,,HOW TO MAKE THAT.
Table structure for table trainer
Column
Type
Null
Default
consumer_id
varchar(10)
No
user_id
varchar(30)
No
password
varchar(30)
No
name
varchar(30)
No
phone
varchar(15)
No
fax
varchar(15)
No
mobile
varchar(15)
No
email_id
varchar(20)
No
address
varchar(250)
No
landmark
varchar(250)
No
type
varchar(50)
No
skill1
varchar(20)
No
skill2
varchar(20)
No
skill3
varchar(20)
No
skill4
varchar(20)
No
skill5
varchar(20)
No
short_description
varchar(50)
No
full_description
varchar(250)
No
mode_trainingid
varchar(30)
No
strength
varchar(20)
No
experience
varchar(10)
No
established_year
varchar(10)
No
contact_person1
varchar(30)
No
contact_person2
varchar(30)
No
contact_person1_phone
varchar(30)
No
contact_person2_phone
varchar(15)
No
contact_person1_email
varchar(30)
No
contact_person2_email
varchar(30)
No
career_guidance
varchar(30)
No
lab
varchar(30)
No
mentor_service
varchar(30)
No
logo
blob
No
url
varchar(30)
No
video_link1
longblob
No
video_link2
longblob
No
routemap_text
text
No
routemap_image
blob
No
routemap_google
longblob
No
weekday_hours
varchar(20)
No
saturday_hours
varchar(20)
No
sunday_hours
varchar(20)
No
Hi prashant,
i am not getting the list because data is not fetching from the data base so, the list is not displaying. i add the code below please revert me as soon as possible. i am in bottleneck position,
list.jsp
<%
try{
Connection con;
Statement stmt;
ResultSet rs;
String host="jdbc:mysql://localhost:3306/books";
//books is the database name
String uName="root";
String uPass="root";
con=DriverManager.getConnection(host,uName,uPass);
stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
/* copy the countries name in the table "country" with a field name countries
countrieslist =
"Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bhutan",
"Bolivia",
"Bosnia and Herzegovina",
"Botswana",
"Brazil",
"Brunei",
"Bulgaria",
"Burkina Faso",
"Burundi",
"Cambodia",
"Cameroon",
"Canada",
"Cape Verde",
"Central African Republic",
"Chad",
"Chile",
"China",
"Colombi",
"Comoros",
"Congo (Brazzaville)",
"Congo",
"Costa Rica",
"Cote d'Ivoire",
"Croatia",
"Cuba",
"Cyprus",
"Czech Republic",
"Denmark",
"Djibouti",
"Dominica",
"Dominican Republic",
"East Timor (Timor Timur)",
"Ecuador",
"Egypt",
"El Salvador",
"Equatorial Guinea",
"Eritrea",
"Estonia",
"Ethiopia",
"Fiji",
"Finland",
"France",
"Gabon",
"Gambia, The",
"Georgia",
"Germany",
"Ghana",
"Greece",
"Grenada",
"Guatemala",
"Guinea",
"Guinea-Bissau",
"Guyana",
"Haiti",
"Honduras",
"Hungary",
"Iceland",
"India",
"Indonesia",
"Iran",
"Iraq",
"Ireland",
"Israel",
"Italy",
"Jamaica",
"Japan",
"Jordan",
"Kazakhstan",
"Kenya",
"Kiribati",
"Korea, North",
"Korea, South",
"Kuwait",
"Kyrgyzstan",
"Laos",
"Latvia",
"Lebanon",
"Lesotho",
"Liberia",
"Libya",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Macedonia",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Mauritania",
"Mauritius",
"Mexico",
"Micronesia",
"Moldova",
"Monaco",
"Mongolia",
"Morocco",
"Mozambique",
"Myanmar",
"Namibia",
"Nauru",
"Nepal",
"Netherlands",
"New Zealand",
"Nicaragua",
"Niger",
"Nigeria",
"Norway",
"Oman",
"Pakistan",
"Palau",
"Panama",
"Papua New Guinea",
"Paraguay",
"Peru",
"Philippines",
"Poland",
"Portugal",
"Qatar",
"Romania",
"Russia",
"Rwanda",
"Saint Kitts and Nevis",
"Saint Lucia",
"Saint Vincent",
"Samoa",
"San Marino",
"Sao Tome and Principe",
"Saudi Arabia",
"Senegal",
"Serbia and Montenegro",
"Seychelles",
"Sierra Leone",
"Singapore",
"Slovakia",
"Slovenia",
"Solomon Islands",
"Somalia",
"South Africa",
"Spain",
"Sri Lanka",
"Sudan",
"Suriname",
"Swaziland",
"Sweden",
"Switzerland",
"Syria",
"Taiwan",
"Tajikistan",
"Tanzania",
"Thailand",
"Togo",
"Tonga",
"Trinidad and Tobago",
"Tunisia",
"Turkey",
"Turkmenistan",
"Tuvalu",
"Uganda",
"Ukraine",
"United Arab Emirates",
"United Kingdom",
"United States",
"Uruguay",
"Uzbekistan",
"Vanuatu",
"Vatican City",
"Venezuela",
"Vietnam",
"Yemen",
"Zambia",
"Zimbabwe"
};*/
String query = (String)request.getParameter("q");
String sql="select countries from country where countries like '"+query+"%'";
rs=stmt.executeQuery(sql);
rs.last();
int length=rs.getRow();
response.setHeader("Content-Type", "text/html");
int cnt=1;
if(rs.first()){
for(int i=0;i=10)
break;
cnt++;
rs.next();
}
}
}
else{
out.println(“country name not in the database”);
}
%>
Hi prashanth,
Please send me the code regarding jquery tree view in jsp using data base please any one help me .
Regards
sharath
hi prasanth,i want to split two different datas in one text box and insert into mysql in jsp.i already got the code for splitting the two datas in one text box.now i want to insert that dats in mysql in two different rows.
this is the code for SPLITTING THE TWO DATAS.NOW HOW TO INSERT THAT DATAS IN TWO DIFFERENT ROWS IN MYSQL.PLZ HELP
// For: http://www.webdeveloper.com/forum/showthread.php?t=244715
String.prototype.trim = function() {
return(this.replace(/^\s+/,”).replace(/\s+$/,”));
}
var queryStringInfo = [];
function validate() {
var temp = document.getElementById(‘info’).value.trim();
var queryStringInfo = temp.split(‘ ‘);
var wcnt = 0;
var str = ”;
for (var i=0; i<queryStringInfo.length; i++) {
wcnt++; str += 'Word #'+wcnt+' '+queryStringInfo[i].trim()+'\n'; }
alert(str);
if (wcnt != 2) { alert('Invalid input: 2 words only!'); return false; }
return true;
}
Hi,
Can some one please help me with my requirement plz.
My requirement is every name should be clickable.When ever user will click on any the country name,it should redirect user to a URL.:
eg:If user selects “USA”,he should get redirected to http://www.us.com(This URL will be caculated from server side code.)
Thanks,
Sanjana
hi,
can u please tell me from where to download the two js file please ……
You can easily get it from the demo source.
anyway.. you can download these files
http://prashapplication.appspot.com/auto_complete/JS/jquery.autocomplete.js
http://prashapplication.appspot.com/auto_complete/JS/jquery-1.4.2.min.js
how to encrypt and decrypt in jsp.i need the code regarding encrypted datas in to decrypt.
Hello Dhanesh,
you can create a bean for getEncrypted() and getDescrypted()
and you can write your algorithm inside them to access from JSP.
here is a sample code for encryption and decryption
http://www.daniweb.com/software-development/java/threads/70469/password-encryptdecrypt
acually i want to create encrypted and decrypted datas in jsp.how it can access from jsp.can u give me code for encrypted and decryped datas in jsp.plz help me.
can u help me.actually, i want to insert videos in php using mysql.how to insert videos in php using mysql.please help me.
plz help me that.
Can this integrate with the database values?.Is it possible to retrieve values from Oracle Db and auto complete text box using that values? thanks
Yes obviously. Actually it all depends on what you fetch in to the JSP page, same thing gonna display into the text list.
So I guess, you can retrive the Oracle data into JSP, rt?
hi prasahanth ,how to retrieve and split the datas from database mysql using php and display
plz help me to retrieve and display and split the inserted data from mysql using php
hii men thanks for all,but i have a question how i made a autocomplete whith my mysql db in jsp?
pd:sorri for mi bad english i am of south america
thankss
in this example I am using array of countries.. but you have to behave similar with the database received data.
so that the result set will be the array to display into the autocomplete.
Very good content
how to retrieve datas from mysql using next and previous button in php.
actually i need the source code for retrieving datas from mysql in php .
example
name department
hari ,kiran hr
jagan,lal accounts
if we click next button it shows hari in hr and again we click next button it shows kiran in hr like that indually it shows
plz help me that.
how to retrieve datas from mysql using next and previous button in php.
actually i need the source code for retrieving datas from mysql in php .
example
name department
hari ,kiran hr
jagan,lal accounts
if we click next button it shows hari in hr and again we click next button it shows kiran in hr like that indually it shows
plz help me that.
Hi,
i have one question, is there way to populate the full list (the dropdown list with all the data) when clicking on button when there is nothing entered in the text box.
Thank you
Dejan
how to swap three rows using php with mysql.actually i tried this code but it is not working properly.the code will be given below
query(‘SELECT id,day,month,year,location,venue FROM TopTips ORDER BY id ASC LIMIT 0,1000’);
// Get an array containing the results.
// Loop for each item in that array
echo ‘Top Tips’;
while ($row =mysql_fetch_array($result)){
echo ”;
echo ”;
echo $row[‘day’];
echo ”;
echo ”;
echo $row[‘month’];
echo ”;
echo ”;
echo $row[‘year’];
echo ”;
echo ”;
echo $row[‘location’];
echo ”;
echo ”;
echo $row[‘venue’];
echo ”;
echo ”;
echo ‘EDIT /’;
echo ”;
echo ”;
echo ‘DELETE‘;
echo ‘ ‘;
echo ‘ ‘;
echo ”;
echo ”;
echo ‘‘;
echo ”;
echo ”;
echo ”;
}
?>
hi prashant ,
last few days i was trying to make a auto-complete extender in my project and my code showed only error after that i seen your code ,its nice and running a superbly ,thank u
Hi prashant,
Thanks for your useful post.
how to retrieve registraction form datas from textfile in php.
how to create datepicker in php.can u explain in full detail
Use Javascript or Jquery.
hello it is probable to use this plugin in key-value paire if yes please tell how to proceed
hi Prashant thank you for this incredible plugint help me a lot,
but i want to know if this plugin supports id/value (if i click on value the id wil be showed on textbox ) is that possible ? and how can i proceed thank you 😉
Hello Prashant, how if I want to autocomplete more than one textbox only using one database query search?
For example I have a database containing country name and the capitals. and in the webpage I have two textboxes to be filled, one by the country name, and the other one by the corresponding capital. How to fill both textboxes after one of them have been auto-completed?
Thank you
Use ajax for capital, on blur of the country textbox.
Hello Prashant,i have tried a lot bt why ths code is nt working properly???do i need to connect db fr all field??
please use same Jquery version I have suggested.
Hello prasanth i used your code for passing additional parameters to get the auto complete feature.
when i select some products in a dropdown, and after that when i type some letters in the text box, it should display the corresponding items for the dropdown selected.
reference:
————————————————————————————————
$(“#country”).autocomplete(“list.jsp”,{extraParams: { active : function() { return $(‘input[name=dropdown_name]‘).val(); }} });
————————————————————————————————
and u asked to retrieve the value with “active” variable. when i received i am getting only null value.
in the “dropdown_name” i replaced my dropdown control name say “nodeName”.
how to resolve it. please guide.
hello..
please help me about auto complete text example..
I have tried your example, but still it is not working.. please help
Hi Nikita,
Please use same version of jquery.autocomplete.js. It will work.
Hello, Thanks.. But I have wanted it urgently,
I have used source method of autocomplete function in jquery.
And It will work fine..
Here, I have used the code.
$(“#tags”).autocomplete({
source: function(request, response) {
var matches = $.map(list, function(tag) {
if (tag.toUpperCase().indexOf(request.term.toUpperCase()) === 0) {
return tag;
}
});
response(matches);
}
});
});
Again thanks your reply..
I will use same version of autocomplete and will try it other way too.
Hi Prasanth,
Your code is not working for jquery verion 1.9 . please help me .
Hi Sarath,
Please use same Jquery that I have uploaded.
This example do not work with newer version.
hi prashant ur code is not working for me . will u pls help me ?
Please use same JS files that is with the example.
can u send me the proper list.jsp file?? pls its urgent
yeahh i used same .js files. Still not working. I think problem is with list.jsp
<%
String countries[] = { "Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Yemen",
"Zambia",
"Zimbabwe"
};
String query = (String)request.getParameter("q");
// System.out.println("1"+request.getParameterNames().nextElement());
response.setHeader("Content-Type", "text/html");
int cnt=1;
for(int i=0;i=10)
break;
cnt++;
}
}
%>
this is the code i am using
hi prashanth plz help me
i want the code for insert delete and edit datas are displayed in same page in php or ajax.plz help its urgent
hello prasanth plz help me plz
how to display images from mysql in php.its urgent could u plz help me
hi
i Tried Your Example But It Is Not Working,
I Think Its Unable To Connect List.jsp File.
Hello,
I got everything working and I even connect it to database. I have 2 text boxes that one cascading the values of the other… I got that working too :-)… but I ran in to an issue with cache I believe… Here is the issue:
1st time search on box 1 selected a value and box 2 select a value… works
2nd time search on something else selected a value and box 2 CONTAIN results from 1st and second search…
Is there any way when search on box one to reset the values of 2nd box using keyup function…
I do not want to use $(“#tag”).val(”); I need to reset the result list on 1st search.
Hope you get my explanation…
Tnx in adv.
Hi prashant sir………in the above eg(Autocomplete Textbox in JSP)…………where i get style.css,jquery-1.4.2.min.js and ,jquery.autocomplete.js
I have given a download link to the bottom of the post.
Please download from there. Thanks.
plz help me.how to display images from mysql using jsp and jsf.
hai prasanth sir,i would like to know that,my login page is not working .i try to login using swings ,the code i will give you
in this below code the error is
Exception in thread “AWT-EventQueue-0” java.lang.UnsupportedOperationException: Not supported yet.
what is this ? plz help me
package studentmanagementsystems;
/**
*
* @author REDMOND
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import java.io.*;
class Login extends JFrame implements ActionListener
{
JLabel l1, l2, l3;
JTextField tf1;
JButton btn1;
JPasswordField p1;
Login()
{
setTitle(“Login form in windows form”);
setVisible(true);
setSize(800,800);
setLayout(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
l1=new JLabel(“Login form in windows form”);
l1.setForeground(Color.blue);
l1.setFont(new Font(“serif”,Font.BOLD,20));
l2=new JLabel(“Enter Email”);
l3=new JLabel(“enter password”);
tf1=new JTextField();
p1=new JPasswordField();
btn1=new JButton(“Submit”);
l1.setBounds(100, 30, 400, 30);
l2.setBounds(80, 70, 200, 30);
l3.setBounds(80, 110, 200, 30);
tf1.setBounds(300, 70, 200, 30);
p1.setBounds(300, 110, 200, 30);
btn1.setBounds(150, 160, 100, 30);
add(l1);
add(l2);
add(tf1);
add(l3);
add(p1);
add(btn1);
btn1.addActionListener(this);
}
public void ActionPerformed(ActionEvent e)
{
showData();
}
public void showData()
{
JFrame f1=new JFrame();
JLabel l, l0;
String str1=tf1.getText();
char[] p=p1.getPassword();
String str2=new String(p);
try
{
Class.forName(“com.mysql.jdbc.Driver”);
Connection con = DriverManager.getConnection(“jdbc:mysql://localhost:3306/course”, “root”, “admin”);
PreparedStatement ps=con.prepareStatement(“select name from reg where email=? and pass=?”);
ps.setString(1, str1);
ps.setString(2, str2);
ResultSet rs=ps.executeQuery();
if (rs.next())
{
f1.setVisible(true);
f1.setSize(600, 600);
f1.setLayout(null);
l=new JLabel();
l0=new JLabel(“you are successfully loggede in”);
l0.setForeground(Color.blue);
l0.setFont(new Font(“Serif”,Font.BOLD,30));
l.setBounds(60, 50, 400, 30);
l0.setBounds(60, 100, 400, 40);
f1.add(l);
f1.add(l0);
l.setText(“Welcome ” + rs.getString(1));
l.setForeground(Color.red);
l.setFont(new Font(“serif”,Font.BOLD,30));
}
else
{
JOptionPane.showMessageDialog(null,
“Incorrect email-Id or password..Try Again with correct detail”);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String as[])throws IOException
{
try
{
new Login();
}catch(Exception e)
{
e.printStackTrace();
}
}
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException(“Not supported yet.”);
}
}
i
Hi Prashant,
My requirement is pretty much same as the sample code provided by you, the only thing is that on selection of country name i have to set country id in hidden field.
I want to know how i can use json string something like this
country : [
{id : 1,
name : “India”,
code : “91”
},
{
id : 2,
name : “USA”,
code : “001”
}
]
so that when the user type ind, in the textfield India will come plus id 1 will get saved in some hidden field.
Regards
Kiran
hi prasanth
how to update datas of two different tables using jsp and hibernate in oracle
hi prasanth how to approve and disapprove datas using jsp
hi prasanth ,how to create a graphical password in jsp,i tried to create but it was not working,i add so many images in a field but it was not active.pleadse help me
Hi sir ,i am using this code,autocomplete is working,thn how to get selected textbox value in javascript.for example
Name :java
Selected Value:java
auto complete text box with multiple value using jquery jsp mysql
there is error showing after saving data in vb 6 the error is runtime error 424 object requred the database is sql server in VB6.plz find a solution for this