To day i'm going to show you a simple search engine project based on the web classification it was done during my final year semester....
Modules are
-------------
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home Page</title>
<script type="text/javascript">
function n()
{
document.location.href="new.jsp";
}
function check()
{
if(form1.username.value=="")
{
alert("Please Enter Your User ID");
form1.username.focus();
return false;
}
if(form1.password.value=="")
{
alert("Please Enter Your Password");
form1.password.focus();
return false;
}
return true;
}
</script>
<style type="text/css">
<!--
.b:hover {background-image:url(images/templatemo_header.jpg); }
.b { width: 78px;
background: url(images/sign-button.gif) no-repeat 0 0;
height: 41px;
line-height: 29px;
padding: 0;
font-weight: bold;
padding-lef: 11px;
color: #fff;
}
.n:hover {background-image:url(images/signup_hover.jpg); }
.n { width: 100px;
background-image:url(images/signup.jpg);
background-repeat: no-repeat;
height: 41px;
font-weight: bold;
color: #fff;
}
.s {
font-family: Courier New, Courier, monospace;
font-size: 19px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
color: #CCC;
text-decoration: none;
background-image: url(images/slider-bg.jpg);
background-repeat: no-repeat;
text-transform: capitalize;
word-spacing: normal;
cursor: auto;
}
.d {
font-family: Courier New, Courier, monospace;
font-size: 19px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
color: #CCC;
text-decoration: none;
cursor: auto;
}
-->
</style>
</head>
<body background="apple_wall_2-1680x1050.jpg">
<table class="s" width="697" height="436" border="0" align="center">
<tr>
<td width="334" height="207"><form name="form1" method="post" action="login.jsp">
<div align="left"><br/><br/><br/>
<p> <img src="tablerightmemberslogin.gif" width="229" height="25" /></p>
<p>
User Name :
<input type="text" name="username" id="username" />
</p>
<p>
Password :
<input type="password" name="password" id="password" />
</p>
<p> <input type="button" class="n" value="Sign Up" onclick="n()"/>
<input class="b" type="submit" name="login" id="login" value="Login" onclick="return check()"/>
<input class="b" type="reset" name="clear" id="clear" value="Clear" />
</p>
<p> </p>
</div>
</form></td>
</tr>
<td align="left">
<pre class="d"><br/><br/>
<font color="orange">Project Done By :</font>
1.Anson Francis
2.Bibin Joseph
3.Jubit Varghese Joy
4.S Nijanthan
<font color="orange">Project Guided By :</font>
1.S Gunasekaran
2.A P V Raghavendra
</pre>
</td>
</table>
</body>
</html>
It is the designing part.....and the jsp code for login page is
Login.jsp
------------
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.StringTokenizer" %>
<%@ page import="java.lang.*" %>
<%!ResultSet rs = null;%>
<%
String user = request.getParameter("username");
String pass = request.getParameter("password");
application.setAttribute("uname",user);
int flag = 0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =DriverManager.getConnection("jdbc:odbc:ndb");
Statement st = con.createStatement();
rs = st.executeQuery("select * from login");
String dbuser = "";
String dbpass = "";
String dbcountry="";
if (!con.isClosed())
{
while (rs.next())
{
dbuser = rs.getString("username");
dbpass = rs.getString("password");
dbcountry=rs.getString("country");
application.setAttribute("upass",dbpass);
if (user.equalsIgnoreCase(dbuser) && pass.equalsIgnoreCase(dbpass))
{
flag = 1;
application.setAttribute("dbcon",dbcountry);
}
}
if (flag == 1)
{
response.sendRedirect("search.jsp");
}
else
{
response.sendRedirect("error.jsp");
}
}
con.close();
}
catch (Exception ex)
{
out.println("Unable to connect to database. " + ex);
}
%>
Modules are
-------------
- Login Page
- Search Page
- Normal Search
- Searching Using Adanced Unconstrained Profiling Tool
4.Admin Page for automatic database loading
Login Page
--------------
index.jsp
-----------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home Page</title>
<script type="text/javascript">
function n()
{
document.location.href="new.jsp";
}
function check()
{
if(form1.username.value=="")
{
alert("Please Enter Your User ID");
form1.username.focus();
return false;
}
if(form1.password.value=="")
{
alert("Please Enter Your Password");
form1.password.focus();
return false;
}
return true;
}
</script>
<style type="text/css">
<!--
.b:hover {background-image:url(images/templatemo_header.jpg); }
.b { width: 78px;
background: url(images/sign-button.gif) no-repeat 0 0;
height: 41px;
line-height: 29px;
padding: 0;
font-weight: bold;
padding-lef: 11px;
color: #fff;
}
.n:hover {background-image:url(images/signup_hover.jpg); }
.n { width: 100px;
background-image:url(images/signup.jpg);
background-repeat: no-repeat;
height: 41px;
font-weight: bold;
color: #fff;
}
.s {
font-family: Courier New, Courier, monospace;
font-size: 19px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
color: #CCC;
text-decoration: none;
background-image: url(images/slider-bg.jpg);
background-repeat: no-repeat;
text-transform: capitalize;
word-spacing: normal;
cursor: auto;
}
.d {
font-family: Courier New, Courier, monospace;
font-size: 19px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
color: #CCC;
text-decoration: none;
cursor: auto;
}
-->
</style>
</head>
<body background="apple_wall_2-1680x1050.jpg">
<table class="s" width="697" height="436" border="0" align="center">
<tr>
<td width="334" height="207"><form name="form1" method="post" action="login.jsp">
<div align="left"><br/><br/><br/>
<p> <img src="tablerightmemberslogin.gif" width="229" height="25" /></p>
<p>
User Name :
<input type="text" name="username" id="username" />
</p>
<p>
Password :
<input type="password" name="password" id="password" />
</p>
<p> <input type="button" class="n" value="Sign Up" onclick="n()"/>
<input class="b" type="submit" name="login" id="login" value="Login" onclick="return check()"/>
<input class="b" type="reset" name="clear" id="clear" value="Clear" />
</p>
<p> </p>
</div>
</form></td>
</tr>
<td align="left">
<pre class="d"><br/><br/>
<font color="orange">Project Done By :</font>
1.Anson Francis
2.Bibin Joseph
3.Jubit Varghese Joy
4.S Nijanthan
<font color="orange">Project Guided By :</font>
1.S Gunasekaran
2.A P V Raghavendra
</pre>
</td>
</table>
</body>
</html>
It is the designing part.....and the jsp code for login page is
Login.jsp
------------
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.StringTokenizer" %>
<%@ page import="java.lang.*" %>
<%!ResultSet rs = null;%>
<%
String user = request.getParameter("username");
String pass = request.getParameter("password");
application.setAttribute("uname",user);
int flag = 0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =DriverManager.getConnection("jdbc:odbc:ndb");
Statement st = con.createStatement();
rs = st.executeQuery("select * from login");
String dbuser = "";
String dbpass = "";
String dbcountry="";
if (!con.isClosed())
{
while (rs.next())
{
dbuser = rs.getString("username");
dbpass = rs.getString("password");
dbcountry=rs.getString("country");
application.setAttribute("upass",dbpass);
if (user.equalsIgnoreCase(dbuser) && pass.equalsIgnoreCase(dbpass))
{
flag = 1;
application.setAttribute("dbcon",dbcountry);
}
}
if (flag == 1)
{
response.sendRedirect("search.jsp");
}
else
{
response.sendRedirect("error.jsp");
}
}
con.close();
}
catch (Exception ex)
{
out.println("Unable to connect to database. " + ex);
}
%>

No comments:
Post a Comment