Now we are going to create the welcome.jsp page. After login the user can see his result own result.
The code is ::
<%--
Document : welcome
Created on : 3 Nov, 2012, 7:57:13 PM
Author : nested code
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Mark sheet Page</title>
</head>
<body>
<%@ page language="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.sql.DriverManager.*" %>
<center>
<h1><b>NESTEDCODE.BLOGSPOT.COM</b></h1>
<br><h2><u>Your result is published here</u></h2><br>
<%
String m=null, mn=null,dmn=null,mar=null,per=null,gre=null,name=null,date=null;
String s=request.getParameter("id");
// String s1=request.getParameter("id");
//String s2=request.getParameter("date");
PreparedStatement ps=null;
Connection con= null;
ResultSet rs= null;
ResultSet rs1= null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","summer3");
Statement st=con.createStatement();
rs=st.executeQuery("select * from result where id='"+ s+"' ");
while(rs.next())
{
m=rs.getString(4);
mn=rs.getString(2);
dmn=rs.getString(3);
mar=rs.getString(1);
// per=rs.getString(5);
// gre=rs.getString(5);
}
%>
<table border="1">
<tr>
<td>ID</td>
<td>Marks</td>
<td>Percent</td>
<td>Gread</td>
</tr>
<tr>
<td><% out.println(m); %></td>
<td><% out.println(mar); %></td>
<td><% out.println(mn); %></td>
<td><% out.println(dmn); %></td>
</tr>
</table>
</center>
</body>
</html>
Out put ::
Previous Lesson Next Lesson
The code is ::
<%--
Document : welcome
Created on : 3 Nov, 2012, 7:57:13 PM
Author : nested code
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Mark sheet Page</title>
</head>
<body>
<%@ page language="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.sql.DriverManager.*" %>
<center>
<h1><b>NESTEDCODE.BLOGSPOT.COM</b></h1>
<br><h2><u>Your result is published here</u></h2><br>
<%
String m=null, mn=null,dmn=null,mar=null,per=null,gre=null,name=null,date=null;
String s=request.getParameter("id");
// String s1=request.getParameter("id");
//String s2=request.getParameter("date");
PreparedStatement ps=null;
Connection con= null;
ResultSet rs= null;
ResultSet rs1= null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","summer3");
Statement st=con.createStatement();
rs=st.executeQuery("select * from result where id='"+ s+"' ");
while(rs.next())
{
m=rs.getString(4);
mn=rs.getString(2);
dmn=rs.getString(3);
mar=rs.getString(1);
// per=rs.getString(5);
// gre=rs.getString(5);
}
%>
<table border="1">
<tr>
<td>ID</td>
<td>Marks</td>
<td>Percent</td>
<td>Gread</td>
</tr>
<tr>
<td><% out.println(m); %></td>
<td><% out.println(mar); %></td>
<td><% out.println(mn); %></td>
<td><% out.println(dmn); %></td>
</tr>
</table>
</center>
</body>
</html>
Out put ::
Note: Here the database table is used is "result", You have to create this in back end.
No comments:
Post a Comment