Searching with alphabetical order

Searching with alphabetical order

View Answers

August 12, 2008 at 12:02 PM

hai...
u r telling that u have only a text box and two buttons in the page...then frm where came this drop down box...?
again, if user types the name in the name text box , y u want to show the same name in drop down box again?
either u can show the whole names in the database to dropdown box or u can show the names matching to the user typed names...



for both ways...u can use the same method....


<%@ page import="java.sql.*" %>
<%! Connection con;
ResultSet rst;
Statement st;
String url="jdbc:db2://url/dbase:";

%>

<tbody>
<tr>
<td height="65"><a href="http://localhost:9081/voc/logout.jsp">LOG OUT</a></td>
</tr>
<tr>
<td height="244" align="center">
<table border="0" width="208" height="98">
<tbody>


<tr>
<td width="91">NAME</td>


??????????FROM HERE ITS FOR DISPLAYING THE LIST!!!!!!!

<td width="115">
<select name="cid">
<%
try
{
Class.forName("com.ibm.db2.jcc.DB2Driver");
con=DriverManager.getConnection(url,"username","pwd");
System.out.println("After Establishing connection");
}
catch(ClassNotFoundException e)
{
System.out.println("ERROR!1: "+e);
request.setAttribute("message", "ERROR");
ServletContext ctx=getServletContext();
RequestDispatcher dis=ctx.getRequestDispatcher("index.jsp");
dis.forward(request,response);
}
try
{

st=con.createStatement();
rst=st.executeQuery("select * from tbl_namelist");
System.out.println("After name list");
while(rst.next())
{%>

<option value="<%= rst.getString(1) %>"><%= rst.getString(2) %></option>
<% }

System.out.println("After reading values");

}

catch(Exception e)
{
System.out.println("ERROR!!2 :"+e);
request.setAttribute("message", "ERROR");
ServletContext ctx=getServletContext();
RequestDispatcher dis=ctx.getRequestDispatcher("index.jsp");
dis.forward(request,response);
}




this will show all the names in the databse table to the dropdown list....


if u want to show the names similar to the user typed ..then add a text box above the drop down box and change the sql command to select * from tbl-namelist where name= the value from the text box.....

then it will show only the names matching with the user typed names...
aftr selecting a name from the dropdown box, and aftr submittin....use the code i gave on yesterday......

August 12, 2008 at 12:14 PM

Read for information.

http://www.roseindia.net/jsp/

Thanks.

Amardeep









Related Tutorials/Questions & Answers:
Searching with alphabetical order - Java Beginners
Searching with alphabetical order  Hi, I want to this please help me Steps:- 1:-I have a one form of name text box with two button. 2:-user input in name text box(alphabetical order)search all fields from
Searching with alphabetical order - Java Beginners
. 2:-User input in the name text box(searching alphabetical order) name...Searching with alphabetical order  Hi, please understood my problem and send write code its very urgent I a write once again. Steps
Advertisements
Alphabetical order - Java Beginners
clicked the view button Now i want to display the files in alphabetical order...Alphabetical order  Hi.. I've a swings application about adding a record into a file and displaying it in text area. It contains the fields... ID
Alphabetical order - Java Beginners
in alphabetical order of ID. How can i implement this... Pls Help..:) Thanks...Alphabetical order  Hi.. I've a swings application about adding a record into a file and displaying it in text area. It contains the fields... ID
Reverse word of string in alphabetical order
Reverse word of string in alphabetical order  wap a program that reverse word of string in alphabetical order. e.g. input by user The purpose of education is to replace an empty mind with an open one output
How to index a given paragraph in alphabetical order
How to index a given paragraph in alphabetical order  Write a java program to index a given paragraph. Paragraph should be obtained during runtime. The output should be the list of all the available indices. For example: Input
How would I get this linked list in alphabetical order?
How would I get this linked list in alphabetical order?   import java.io.*; import java.util.Scanner; public class LinkedList2 { public... but i can get in in alphabetical order
Arrange the sentences in alphabetical order of words Java
Arrange the sentences in alphabetical order of words In Java Program... the sentences in alphabetical order of words. Here is the code for sorting Sentence in Alphabetical order: import java.util.*; import java.util.regex.
order
order   write a java code to enter order of number of chocolates(bar,powder,giftbox) in arraylist. Also consider exceptional cases like entering integer in name use try,catch ,throw to deal with exception
searching books
searching books  how to write a code for searching books in a library through jsp
searching technique
searching technique  Hi, i need any searching technique in java to search the data and give the all possible data by links
searching problem
searching problem  how we can make a code in core java for searching in hard disk? i have to make an antivirus as my minor project , so i have need this type code to search the virus in hard disk
searching problem
searching problem  how we can make a code in core java for searching in hard disk? i have to make an antivirus as my minor project , so i have need this type code to search the virus in hard disk
file searching
file searching  i need a prog for searching inside a text file after evry 1 min to find does it hav any new entry
searching string
searching string   how to write a program for searching a string   Hi Friend, Try this: import java.util.*; class SearchString{ public static void main(String[] args){ Scanner input=new Scanner(System.in
searching the data
searching the data  respected sir , i am making the desktop application , so how can i search the data which are stored in the mysql databses through click the button and display in jtable through netbeans dynamically
Read a string and reverse it and then print in alphabetical order.
Read a string and reverse it and then print in alphabetical order... String reverse(String str) method and set in alphabetical order by String... it and arrange in alphabetical order. ReverseAlphabetical.java
Searching - Hibernate
'Sandeep' order by record.userid"; Query query = session.createQuery(SQL
searching inside a file for details
searching inside a file for details  i created a file with name,country,state etc...when i'm searching for the name, i have to get other details like country,state etc...please do help
searching the string in a paragraph?
searching the string in a paragraph?  how to search a string in a paragraph and display the corresponding line number and position of a string in java
Searching for Code - JSP-Servlet
JSP, Servlet Searching for Code  Hi, i am looking for a jsp servlet code examples for the search function in my application.Thanks
searching from database
searching from database  how to search data from data base throug search...such as contact no./lastname /firstname should give whole information from database...   Please visit the following link: Servlet search
Searching an element - JSP-Servlet
Searching an element  Dear sir, sir i have an employee... in that i am doing a searching an element by empId and displaying a all... field for searching an element by the empId.and one submit button for submitting
Searching an element - JSP-Servlet
Searching an element  Dear sir, sir i have an employee table... doing a searching an element by empId and displaying a all the employee table... for searching an element by the empId.and one submit button for submitting this form.And
Java String searching.
Java String searching.  How to search a string in given String array?   import java.util.Scanner; public class StringSearch { public... and for searching we used userCity.equalsIgnoreCase(city[i
Java Sorting and Searching
Java Sorting and Searching   If anyone could help me with this I would be really thankful! Write a program that stores the names of these artists in a String array. The program should prompt the user to enter the name
Searching English words in a string
Searching English words in a string  My task is to find English words and separate them from a string with concatenated words..for example AhdgdjHOWAREgshshYOUshdhfh I need to find if there exists any English words.   
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project for the Dispatch section of my office. I have to search for letters that are dispatched on a particular date. Now there are thousands of letters dispatched on a particular
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project for the Dispatch section of my office. I have to search for letters that are dispatched on a particular date. Now there are thousands of letters dispatched on a particular
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project for the Dispatch section of my office. I have to search for letters that are dispatched on a particular date. Now there are thousands of letters dispatched on a particular
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project for the Dispatch section of my office. I have to search for letters that are dispatched on a particular date. Now there are thousands of letters dispatched on a particular
searching for strings in a file
searching for strings in a file  how can i search of a person and display the other details associated with the name using java gui window?   import java.util.ArrayList; import javax.swing.*; import java.awt.event.
HQL order by.
HQL order by.  HQL Order by query giving problem.   Order... mention, order by automatically sorted the list in ascending order. Here is an example of order by clause. Since we didn?t mention ?asce? or ?desc? it will return
Finding searching phrase of a search engine
Finding searching phrase of a search engine  how to find out searching phrase of a search engine..? like, if visitors enter the keyword to google, is is any possible to get that keyword
SQL ORDER BY
SQL ORDER BY       The ORDER BY keyword sort the table result set by a specified column. You want to sort the records in ascending order,  you can use the ASC keyword
Ascending order
of them equal to each other, in any order, (for example, 23, 7, 156; but not 23, 7, 23), and then it should print out the three integers in ascending order, saying
Insertion, sorting and searching in array
; } Insertion, sorting and searching in array   ... to perform searching and sorting in array. In the java code given below we have... the specified arrray in ascending order. Arrays.sort(array); show
Searching Mobile developer for image recognition
Searching Mobile developer for image recognition  Hi, I have an idea for an application that requires image recognition. I have decided to use Google platform for image recognition. Our application will provide image to google
Order Entry System
Order Entry System  Create a new order entry system using netbeans and microsoft access.can anyone help me
ModuleNotFoundError: No module named 'order'
ModuleNotFoundError: No module named 'order'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'order' How to remove the ModuleNotFoundError: No module named 'order'
Order by example in MySQL
Order by example in MySQL  Hi, How to use the order by in MySQL? Thanks   Hi, The order by clause in used in MySQL for ordering the result in ascending or descending order. For example following query order the data
Searching For Important Issues for Writing Articles
Searching For Important Issues for Writing Articles       People all over the world like to read... for their art of creating key issues out of scrap. Whenever you are searching
Sorting and Searching
searching a text string in file - Java Beginners
searching a text string in file  code to match a string in a file that is already mentioned in java code.if the string matches any part of a string that whole string is printed
Searching a word file on server in JSP - JSP-Servlet
Searching a word file on server in JSP  Seacrhing a word file on server side using JSP. I am Apache Tomcat Server. Please help me Sir
Java: Searching a string from doc files
Java: Searching a string from doc files   I want to search a string from DOC, DOCX files in java. Can anyone please help me
MySQL Order By
MySQL Order By       Here, you will learn how to use MySQL Order By clause. The Order By clause is used for sorting the data either ascending or descending order according to user
Maven's order of inheritance
Maven's order of inheritance  hello, What is Maven's order of inheritance?   hii,ADS_TO_REPLACE_1 1.parent pom 2.project pom 3.settingsADS_TO_REPLACE_2 4.CLI parameters
Searching a tex on a table in java! - Java Beginners
Searching a tex on a table in java!  i have a table which contains several data. using a textfield the item hat i search must be selected and will show with using a scroll bar.... how should i do this.... tnx for the response
SQL Union with order by
SQL Union with order by  I want to combine three queries using union. 1.SELECT * from user_projects where status='O' order by id desc It returns...' and newproject='yes' order by id descADS_TO_REPLACE_2 It returns the following ids

Ads