program for jsp
<html>
<body>
<select>
<option value="--Select--">--Select--</option>
<%
Statement st;
ResultSet rs;
try
{
String url="jdbc:mysql://localhost:3306/mobile";
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(url,"root","root123");
st=con.createStatement();
rs=st.executeQuery("select name from login");
while(rs.next())
{
String str=rs.getString("name");
%>
<option value="<%=str%>"><%=str%></option>
<%
}%></select>
<%
}catch(Exception e)
{
out.println(e);
}
%>
</body>
</html></body></html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<link rel="stylesheet" type="text/css" href="StyleSheet1.css" />
<script lang="javascript">
function search()
{
window.location.href="search.jsp";
}
</script>
</head>
<body>
<form action="Third.jsp" class="txt">
<table border="2" align="center">
<tr><td>username</td><td><input type="text" name="user"/></td></tr>
<tr><td>password</td><td><input type="Password" name="pass"/></td></tr>
<tr><td><input type="submit" value="submit"/></td><td><input type="button" value="search" onclick="search()"/></td></tr>
</table>
<label for="name">male</label>
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
Statement st;
ResultSet rs;
try
{
String url="jdbc:mysql://localhost:3306/mobile";
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(url,"root","root123");
st=con.createStatement();
rs=st.executeQuery("select name from login");
%>
<table border="2" align="center">
<tr>
<th>Name</th>
<th>Password</th>
</tr>
<%
while(rs.next())
{
%>
<tr >
<td><%=rs.getString(1)%></td>
<td ><%=rs.getString(2)%></td>
</tr>
<%
}
%>
</table>
<%
}catch(Exception e)
{
out.println(e);
}
%>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<script lang="javascript">
function view()
{
window.location.href="Fourth.jsp";
}
</script>
</head>
<body>
<form action="Fourth.jsp">
<input type="button" value="view" onClick="view()"/> </form>
</body>
</html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script lang="javascript">
</script>
</head>
<body>
<form action="search.jsp">
Search by Idc
Id<input type="text" name="id"/>
Search by Id
Mobile<input type="text" name="mobile"/>
<input type="submit" value="Go" />
<%
Connection con;
Statement st;
ResultSet rs;
String id,mobile,qr;
int temp=0;
id=request.getParameter("id");
mobile=request.getParameter("mobile");
if(( id !=null && id!="") && (mobile != null && mobile!=""))
{
try
{
String Url="jdbc:mysql://localhost:3306/mobile";
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(Url,"root","root123");
st=con.createStatement();
qr="select name from record where id='"+id+"'";
rs=st.executeQuery(qr);
%>
<table border="2" align="center">
<tr>
<th>Name</th>
</tr>
<%
while(rs.next())
{
%>
<tr >
<td><%=rs.getString(1)%></td>
</tr>
<%
}
%>
</table>
<%
}catch(Exception e)
{
out.println(e);
}
}
%>
</form>
</body>
</html>