Filename:Stud13.html
<!-- 13. HTML Program to accept Student name -->
<html>
<head>
<title>Student Marks Sheet</title>
</head>
<body>
<h3>Enter the Name of Student:<h3>
<form action="Stud13.jsp" method="POST" >
<input type="text" name="sname" autofocus><br><br>
<input type="submit" value="Get Details">
</body>
</html>
Filename:Stud13.jsp
<!-- 13. JSP Program to Retrieve Student Information from the Database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
String sname=request.getParameter("sname");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:stud13");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from stud13 where sname='"+sname+"'");
while(rs.next())
{
%>
<CENTER>
<table border=5 bgcolor="orange" height=600 width=400 >
<caption><h2><font color="blue" >Marks Sheet</font></h2></caption>
<tr><td>Name</td><td><%=rs.getString("sname")%></td></tr>
<tr><td>Register Number</td><td><%=rs.getString("regno")%></td></tr>
<tr><td>Course</td><td><%=rs.getString("course")%></td></tr>
<tr><td>Subject1</td><td><%=rs.getString("sub1")%></td></tr>
<tr><td>Subject2</td><td><%=rs.getString("sub2")%></td></tr>
<tr><td>Subject3</td><td><%=rs.getString("sub3")%></td></tr>
<tr><td>Subject4</td><td><%=rs.getString("sub4")%></td></tr>
<tr><td>Subject5</td><td><%=rs.getString("sub5")%></td></tr>
<tr><td>Total</td><td><%=rs.getString("total")%></td></tr>
<tr><td>Percent</td><td><%=rs.getString("percent")%></td></tr>
<tr><td>Grade</td><td><%=rs.getString("grade")%></td></tr>
</table>
</CENTER>
<%
}
rs.close();
st.close();
con.close();
%>
</body>
</html>
<!-- 13. HTML Program to accept Student name -->
<html>
<head>
<title>Student Marks Sheet</title>
</head>
<body>
<h3>Enter the Name of Student:<h3>
<form action="Stud13.jsp" method="POST" >
<input type="text" name="sname" autofocus><br><br>
<input type="submit" value="Get Details">
</body>
</html>
Filename:Stud13.jsp
<!-- 13. JSP Program to Retrieve Student Information from the Database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
String sname=request.getParameter("sname");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:stud13");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from stud13 where sname='"+sname+"'");
while(rs.next())
{
%>
<CENTER>
<table border=5 bgcolor="orange" height=600 width=400 >
<caption><h2><font color="blue" >Marks Sheet</font></h2></caption>
<tr><td>Name</td><td><%=rs.getString("sname")%></td></tr>
<tr><td>Register Number</td><td><%=rs.getString("regno")%></td></tr>
<tr><td>Course</td><td><%=rs.getString("course")%></td></tr>
<tr><td>Subject1</td><td><%=rs.getString("sub1")%></td></tr>
<tr><td>Subject2</td><td><%=rs.getString("sub2")%></td></tr>
<tr><td>Subject3</td><td><%=rs.getString("sub3")%></td></tr>
<tr><td>Subject4</td><td><%=rs.getString("sub4")%></td></tr>
<tr><td>Subject5</td><td><%=rs.getString("sub5")%></td></tr>
<tr><td>Total</td><td><%=rs.getString("total")%></td></tr>
<tr><td>Percent</td><td><%=rs.getString("percent")%></td></tr>
<tr><td>Grade</td><td><%=rs.getString("grade")%></td></tr>
</table>
</CENTER>
<%
}
rs.close();
st.close();
con.close();
%>
</body>
</html>
No comments :
Post a Comment