Data Redundancy

Data Redundancy

Sorry for disturbing you again but there's redundancy of the selected data on this jsp u gif me. The selected data will appear twice at the drop down box. I've tried to fix it but still unable to do so. Is there anything can be done?


<%@ page language="java" import="java.util.*"%>
<%@ page import="java.sql.*,java.io.*,javax.servlet.*,javax.servlet.http.*,java.lang.String
"%>
<html>
<head>
<script type="text/javascript">
function change()
{
var answer = document.getElementById('selc').value;
window.location.replace("test.jsp?name="+answer);
}
</script>
</head>
<%
String connectionURL = "jdbc:mysql://localhost:3306/register";;
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test";, "root", "root");
String ans=request.getParameter("name");
response.setContentType("text/html");
String address = "";
String name = "";
try {
String sql = "select * from data where name = '"+ans+"'";
Statement s = connection.createStatement();
s.executeQuery (sql);
ResultSet rs = s.getResultSet();
while (rs.next ()){
address = rs.getString("address");
name=rs.getString("name");
}
rs.close ();
s.close ();
}
catch(Exception e){
System.out.println("Exception is ;"+e);
}
System.out.println(address);

%>

<body>
<h1>Use of Select Box in JSP</h1>
<table border="1" width="41%" height="53" cellspacing="0" cellpadding="3"
bgcolor="#000080" bordercolorlight="#FFFFFF">
<tr>
<td width="100%" height="18" colspan="2"><b>
<font color="#FF00FF">Select items from select box</font></b></td>
</tr>
<tr>
<td width="17%" height="23">
<select onChange="change();" id="selc" >
<%
Statement st=connection.createStatement();
ResultSet rs=st.executeQuery("select name from data");
while(rs.next()){
%>
<option value="<%=rs.getString("name")%>"><%=rs.getString("name")%></option>
<%
if(name.equals(rs.getString("name"))){
%>
<option value="<%=rs.getString("name")%>"selected=selected><%=rs.getString("name")%>></option>
<%
}

}%>
</select>
</td>
<td width="83%" height="23"><input type="text" id="textvalue" value="<%= address %>" />
</td>
</tr>
</table>
</body>
</html>

View Answers









Related Tutorials/Questions & Answers:
Data Redundancy - JSP-Interview Questions
Data Redundancy  Sorry for disturbing you again but there's redundancy of the selected data on this jsp u gif me. The selected data will appear twice at the drop down box. I've tried to fix it but still unable to do so
CRC(cyclic redundancy check) - UML
CRC(cyclic redundancy check)  write a program that accepts a data sequence , generates a fcs (using a known divisor) and then ultimately check whether the recieved data is in error
Advertisements
data
data  Handling data
data
data  data Handling AOP
data
data  Handling data in AOP
data
data handling examples in AOP Model  data handling examples in AOP Model
What is VRRP?
; VRRP the acronyms of  Virtual Router Redundancy Protocol is ...; the data  while  data transmission as it works as a switching system... be another sort of  problem, not in the VRRP system. All the data has been
importing data and edit that data
importing data and edit that data   hello sir i have data in excel sheet which contain 2 rows and i want to import that data to ms access and edit that data like adding new columns and new rows and creating new tables
big data data science
big data data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: big data data... the topic "big data data science". Also tell me which is the good
data science and data mining
data science and data mining  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science and data mining Try to provide me good examples or tutorials links so that I
data mining data science
data mining data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data mining data science Try to provide me good examples or tutorials links so that I can
big data and data science
big data and data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: big data and data science Try to provide me good examples or tutorials links so that I can
data science and data analytics
data science and data analytics  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science and data analytics Try to provide me good examples or tutorials links so
data science data analytics
data science data analytics  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science data analytics Try to provide me good examples or tutorials links so that I
data visualization in data science
data visualization in data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data visualization in data science Try to provide me good examples or tutorials
What is Big Data and Data mining
What is Big Data and Data mining  Hi, Big Data, Data Mining and Data analytics are hot topic these days. What is Big Data and Data mining? Thanks
What is Big Data and Data mining
What is Big Data and Data mining  Hi, Big Data, Data Mining and Data analytics are hot topic these days. What is Big Data and Data mining? Thanks
data processing is
data processing is   data processing is   Data processing is associated with commercial work. Data processing is also referred as Information System. Data processing is basically used for analyzing, processing
data tyape
data tyape   please give me data type of Date
data tyape
data tyape   please give me data type of Date
data tyape
data type of Date  please give me data type of Date
data tyape
data tyape   please give me data type of Date
Data Normalization
Data Normalization       In this section you will learn the concepts of data normalization. The most important thing in database designing is to make sure that the data get properly
data type
data type  which data type is used to store video file in mysql databse
data tyape
What data tyape a date field req in SQL   please give me data type of Date
data tyape
data type of date in mysql  please give me data type of Date
data wrangling vs data mining
data wrangling vs data mining  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data wrangling vs data mining Try to provide me good examples or tutorials links so
data science and big data analytics
data science and big data analytics  Hi, I am beginner in Data...: data science and big data analytics Try to provide me good examples or tutorials links so that I can learn the topic "data science and big data
certificate in big data and data analytics
certificate in big data and data analytics  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: certificate in big data and data analytics Try to provide me good examples
Is big data necessary for data science?
Is big data necessary for data science?  Hi, I am beginner in Data...: Is big data necessary for data science? Try to provide me good examples or tutorials links so that I can learn the topic "Is big data necessary
Is big data and data science same?
Is big data and data science same?  Hi, I am beginner in Data...: Is big data and data science same? Try to provide me good examples or tutorials links so that I can learn the topic "Is big data and data science same?"
Is Data Analyst same as data scientist?
Is Data Analyst same as data scientist?  Hi, I am beginner in Data...: Is Data Analyst same as data scientist? Try to provide me good examples or tutorials links so that I can learn the topic "Is Data Analyst same as data
data wrangling vs data cleaning
data wrangling vs data cleaning  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data wrangling vs data cleaning Try to provide me good examples or tutorials links so
Data objects
Data objects   hello,, What are data objects?   hii,ADS_TO_REPLACE_1 Sequences, Views, clusters, Tables, index and cluster are called data objects for a database
data science
data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science Try...;data science". Also tell me which is the good training courses in Machine
data sains
data sains  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data sains Try to provide me good examples or tutorials links so that I can learn the topic "data
data degrees
data degrees  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data degrees Try...;data degrees". Also tell me which is the good training courses in Machine
be data science
be data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: be data science Try... "be data science". Also tell me which is the good training courses
data types
data types  Write a short note on data types of Java.   Please visit the following link: Java datatypes
Data Generator
Data Generator Data Generator is free open source script that is designed to create the application, which can be used to generate a large sum of data... JavaScript, PHP and MySQL. Characteristics Data generator is browser
Split Data
Split Data  how to split data from to from e.g. sssss-3100@jdkck i want only 3100 data from that string
kaggle data
kaggle data  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: kaggle data Try to provide... Learning, Artificial Intelligence and Data Science for beginners. Thanks  
degree data
degree data  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: degree data Try to provide... Learning, Artificial Intelligence and Data Science for beginners. Thanks  
ms in data
ms in data  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: ms in data Try to provide..., Artificial Intelligence and Data Science for beginners. Thanks   
python data
python data  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: python data Try to provide... Learning, Artificial Intelligence and Data Science for beginners. Thanks  
introduction to data
introduction to data  Hi, I am beginner in Data Science and machine... to data Try to provide me good examples or tutorials links so that I can learn... courses in Machine Learning, Artificial Intelligence and Data Science
masters in data
masters in data  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: masters in data Try... in Machine Learning, Artificial Intelligence and Data Science for beginners. Thanks
r for data
r for data  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: r for data Try to provide..., Artificial Intelligence and Data Science for beginners. Thanks   
coursera data
coursera data  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: coursera data Try... Learning, Artificial Intelligence and Data Science for beginners. Thanks
course data
course data  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: course data Try to provide... Learning, Artificial Intelligence and Data Science for beginners. Thanks  

Ads