Escolar Documentos
Profissional Documentos
Cultura Documentos
clickTObuy.com
(Classified website)
Done under:
NIIT
SCO-36, Sector 12
Faridabad
Submitted By:
Pawan Kumar
271104
CSE- CB2
Index
1. Certificate
2. Acknowledgement
3. Abstract
4. Objective
5. Technical Details
a. Hardware requirements and Software Requirements
b. Basic Architecture
c. Tools Used
6. ER Diagram
7. Tables Used
8. Coding
9. Screenshots
10. Why a Classifieds site
Acknowledgement
The special thank goes to my helpful faculty member, Ms. Lata Verma. The
supervision and support that he gave truly help the progression and
smoothness of the program. The co-operation is much indeed appreciated.
A big contribution and hard worked from him during this six week is very
great indeed. Project during the program would be nothing without his
enthusiasm and imagination. Not forget, great appreciation go to the rest of
staff that help me from time to time during the project.
Pawan Kumar
271104
CSE - 7CB2
Abstract
The site aims the local community could come together, meet, trade and
help each other in many ways. Community members can come here to find
an apartment to live in, sell their old car, bike ,music system, laptop or
furniture, promote their small business or get a break as a model or actor,
join a salsa class, get an audience for a local event, buy any item that they
might want or have to offer and make new friends while doing all of the
above.
Objective
Based on the requirements given in the problem statement above
• Conceptualize the layout of the system and develop the user
interface for the web pages
• Create a Solution Architecture identifying the key components of
your solution.
• Identify the significant entities and carry out detailed design of
Classes, database objects and other solution components based on
which your programming would be based.
• Carry out coding and testing as necessary to produce a program
which can be compiled and run without any bugs.
Technical details
Hardware and Software Requirement
• OS independent - hence any OS can be used
• The Java SE Development Kit (JDK 1.5) which includes the Java Runtime
Environment (JRE)
• MS ACCESS.
• Hardware Required- Pentium 166MHz or faster processor with a minimum of
125MB free disk space and a minimum of 32MB of RAM.
• Java Compatible Web Server
Basic architecture
The system works on client server model
Multiple
thread of
Execution HTTP Request
HTTP Response
Tools used
NetBeans : it’s an IDE for java programming created by Oracle .
The NetBeans IDE is written in Java and runs everywhere where a JVM is
installed, including Windows, Mac OS, Linux, and Solaris. A JDK is required for
Java development functionality, but is not required for development in other
programming languages.
Ms Access is well suited for small applications like in our case of website.
Glass Fish Server 3
GlassFish is an open source application server project led by Sun Microsystems for
the Java EE platform. The proprietary version is called Oracle GlassFish Enterprise
Server. GlassFish is based on source code released by Sun and Oracle Corporation's
TopLink persistence system. It uses a derivative of Apache Tomcat as the servlet
container for serving Web content.
ER Diagram
Tables Used
Ads
<%--
Document : Default
Created on : 22 June, 2010, 10:29:12 AM
Author : Pawan
--%>
%>
<html>
<head>
<title>Click to buy</title>
</head>
<body bgcolor="#FFFFFF">
<jsp:include page="Header.jsp" flush="true"/>
<table>
<tr>
<td valign="top">
<% Search_Show(request, response, session, out, sSearchErr, sForm,
sAction, conn, stat); %>
</td>
<td valign="top">
<% Menu_Show(request, response, session, out, sMenuErr, sForm, sAction,
conn, stat); %>
</td>
</tr>
</table>
<table>
<tr>
<td valign="top">
<% Tree_Show(request, response, session, out, sTreeErr, sForm, sAction,
conn, stat); %>
</td>
</tr>
</table>
<table>
<tr>
<td valign="top">
<% Login_Show(request, response, session, out, sLoginErr, sForm, sAction,
conn, stat); %>
</td>
</tr>
</table>
}
}
catch (Exception e) { out.println(e.toString()); };
return ("");
}
// Subcategory
sWhere = " where category_id=" + sCatID;
rs = openrs ( stat, sSQL + sWhere);
if ( rs.next()) {
java.util.Hashtable rsHash = new java.util.Hashtable();
String[] aFields = getFieldsName( rs );
getRecordToHash( rs, rsHash, aFields );
sCatPath = "";
sCatList = "";
sParCatID = toHTML((String) rsHash.get("par_category_id"));
sCatName = toHTML((String) rsHash.get("name"));
}
rs.close();
sPath = " > "+sCatName+"</font></nobr></td>\n </tr>";
// Build Path
stParCatID = sParCatID;
while ( stParCatID.compareTo("") != 0 ) {
rs = openrs ( stat, sSQL + " where category_id=" + stParCatID);
java.util.Hashtable rsHash = new java.util.Hashtable();
String[] aFields = getFieldsName( rs );
if ( rs.next() ) {
getRecordToHash( rs, rsHash, aFields );
stCatID = toHTML((String) rsHash.get("category_id"));
stParCatID = toHTML((String) rsHash.get("par_category_id"));
stCatName = toHTML((String) rsHash.get("name"));
sPath = "> <a href=\""+sActionFileName+"?
FormName=Tree&category_id="+stCatID+"\"><font face=\"arial\"
size=\"2\" style=\"font:bold\">"+stCatName+"</font></a>" + sPath;
}
rs.close();
}
out.println(sPath);
sWhere = " where par_category_id=" + sCatID;
}
// Categories list
rs = openrs ( stat, sSQL + sWhere);
if (rs != null) {
java.util.Hashtable rsHash = new java.util.Hashtable();
String[] aFields = getFieldsName( rs );
while ( rs.next() ) {
// Print subcategories
getRecordToHash( rs, rsHash, aFields );
stCatID = toHTML((String) rsHash.get("category_id"));
stParCatID = toHTML((String) rsHash.get("par_category_id"));
stCatName = toHTML((String) rsHash.get("name"));
out.println(" </table>");
}
catch (Exception e) { out.println(e.toString()); };
}
String fldname="";
String sSQL="";
String transitParams = "";
String sQueryString = "";
String sPage = "";
out.println(" <table >");
out.println(" <tr>\n <td bgcolor=\"#808080\" align=\"center\"
colspan=\"3\"><a name=\"Search\"><font face=\"arial\" color=\"#FFFFFF\"
style=\"font:bold\">Search</font></a></td>\n </tr>");
out.println(" <form method=\"get\" action=\"AdsGrid.jsp\"
name=\"Search\">\n <tr>");
// Set variables with search parameters
fldname = getParam( request, "name");
// Show fields
out.println(" <td bgcolor=\"#CCCCCC\"><font face=\"arial\"
size=\"2\" style=\"font:bold\">Name</font></td>");
out.print(" <td bgcolor=\"#EEEEEE\">"); out.print("<input
type=\"text\" name=\"name\" maxlength=\"20\"
value=\""+toHTML(fldname)+"\" size=\"20\">");
out.println("</td>");
out.println(" <td ><input type=\"submit\"
value=\"Search\"/></td>");
out.println(" </tr>\n </form>\n </table>");
out.println("");
}
catch (Exception e) { out.println(e.toString()); }
}
String LoginAction(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String
sAction, String sForm, java.sql.Connection conn, java.sql.Statement stat)
throws java.io.IOException {
String sLoginErr = "";
try {
final int iloginAction = 1;
final int ilogoutAction = 2;
String transitParams = "";
String sQueryString = "";
String sPage = "";
String sSQL="";
int iAction = 0;
if ( sAction.equals("login") ) iAction = iloginAction;
if ( sAction.equals("logout") ) iAction = ilogoutAction;
switch (iAction) {
case iloginAction: {
// Login action
String sLogin = getParam( request, "Login");
String sPassword = getParam( request, "Password");
java.sql.ResultSet rs = null;
rs = openrs( stat, "select member_id, member_level from members
where member_login =" + toSQL(sLogin, adText) + " and
member_password=" + toSQL(sPassword, adText));
if ( rs.next() ) {
// Login and password passed
session.setAttribute("UserID", rs.getString(1));
session.setAttribute("UserRights", rs.getString(2));
sQueryString = getParam( request, "querystring");
sPage = getParam( request, "ret_page");
if ( ! sPage.equals(request.getRequestURI() ) && ! "".equals(sPage)) {
try {
if ( stat != null ) stat.close();
if ( conn != null ) conn.close();
}
catch ( java.sql.SQLException ignore ) {}
response.sendRedirect(sPage + "?" + sQueryString);
return "sendRedirect";
}
}
else sLoginErr = "Login or Password is incorrect.";
rs.close();
break;
}
case ilogoutAction: {
// Logout action
session.setAttribute("UserID", "");
session.setAttribute("UserRights", "");
break;
}
}
}
catch (Exception e) { out.println(e.toString()); }
return (sLoginErr);
}
if ( sLoginErr.compareTo("") != 0 ) {
out.println(" <tr>\n <td colspan=\"2\"
bgcolor=\"#EEEEEE\"><font face=\"arial\"
size=\"2\">"+sLoginErr+"</font></td>\n </tr>");
}
sLoginErr="";
out.println(" <form action=\""+sFileName+"\" method=\"POST\">");
out.println(" <input type=\"hidden\" name=\"FormName\"
value=\"Login\">");
if ( session.getAttribute("UserID") == null || ((String)
session.getAttribute("UserID")).compareTo("") == 0 ) {
// User did not login
out.println(" <tr>\n <td bgcolor=\"#CCCCCC\"><font
face=\"arial\" size=\"2\" style=\"font:bold\">Login</font></td><td
bgcolor=\"#EEEEEE\"><input type=\"text\" name=\"Login\"
maxlength=\"50\" value=\""+toHTML(getParam( request, "Login"))
+"\"></td>\n </tr>");
out.println(" <tr>\n <td bgcolor=\"#CCCCCC\"><font
face=\"arial\" size=\"2\" style=\"font:bold\">Password</font></td><td
bgcolor=\"#EEEEEE\"><input type=\"password\" name=\"Password\"
maxlength=\"50\"></td>\n </tr>");
out.print(" <tr>\n <td colspan=\"2\"><input type=\"hidden\"
name=\"FormAction\" value=\"login\"><input type=\"submit\"
value=\"Login\">");
out.println("<input type=\"hidden\" name=\"ret_page\"
value=\""+sPage+"\"><input type=\"hidden\" name=\"querystring\"
value=\""+sQueryString+"\"></td>\n </form>\n </tr>");
}
else {
// User logged in
String sUserID = dLookUp( stat, "members", "member_login",
"member_id =" + session.getAttribute("UserID"));
out.print(" <tr><td bgcolor=\"#EEEEEE\"><font face=\"arial\"
size=\"2\">"+sUserID+" "+"</font><input type=\"hidden\"
name=\"FormAction\" value=\"logout\"/><input type=\"submit\"
value=\"Logout\"/>");
out.print("<input type=\"hidden\" name=\"ret_page\"
value=\""+sPage+"\"><input type=\"hidden\" name=\"querystring\"
value=\""+sQueryString+"\">");
out.println("</td>\n </form>\n </tr>");
}
out.println(" </table>");
}
catch (Exception e) { out.println(e.toString()); }
}
void Menu_Show (javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String
sMenuErr, String sForm, String sAction, java.sql.Connection conn,
java.sql.Statement stat) throws java.io.IOException {
try {
Common.jsp
// this file include all the common database access methods which are used
in every page
if ( isSearch ) {
sOptions += "<option value=\"\">All</option>";
}
else {
if ( ! isRequired ) {
sOptions += "<option value=\"\"></option>";
}
}
try {
java.sql.Statement stat = conn.createStatement();
java.sql.ResultSet rs = null;
rs = openrs (stat, sql);
while (rs.next() ) {
String id = toHTML( rs.getString(1) );
String val = toHTML( rs.getString(2) );
if ( id.compareTo(selectedValue) == 0 ) {
sSel = "SELECTED";
}
else {
sSel = "";
}
sOptions += "<option value=\""+id+"\" "+sSel+">"+val+"</option>";
}
rs.close();
stat.close();
}
catch (Exception e) {}
return sOptions;
}
i++;
if (LOV.hasMoreTokens()) {
val = LOV.nextToken();
if ( ! old.equals(";") && (val.equals(";") ) ) {
val = LOV.nextToken();
}
else {
if (old.equals(";") && (val.equals(";"))) {
val = "";
}
}
if ( val.equals(";") ) { val = ""; }
if ( ! val.equals("")) { old = val; }
i++;
}
if ( id.compareTo( selectedValue ) == 0 ) {
sSel = "SELECTED";
}
else {
sSel = "";
}
slOptions += "<option value=\""+id+"\" "+sSel+">"+val+"</option>";
}
if ( ( i % 2 ) == 0 ) sOptions += slOptions;
return sOptions;
}
i++;
if (LOV.hasMoreTokens()) {
val = LOV.nextToken();
if ( ! old.equals(";") && (val.equals(";") ) ) {
val = LOV.nextToken();
}
else {
if (old.equals(";") && (val.equals(";"))) {
val = "";
}
}
if ( val.equals(";") ) { val = ""; }
if ( ! val.equals("")) { old = val; }
i++;
}
if ( id.compareTo( selectedValue ) == 0 ) {
sRes = val;
}
}
return sRes;
}
if ( bRedirect ) {
response.sendRedirect("Login.jsp?querystring=" +
toURL(request.getQueryString()) + "&ret_page=" +
toURL(request.getRequestURI()));
return "sendRedirect";
}
}
catch(Exception e){};
return "";
}
%>
Header.jsp
// common header used in every page
Login.jsp
<body bgcolor="#FFFFFF">
<jsp:include page="Header.jsp" flush="true"/>
<table>
<tr>
<td valign="top">
<% Login_Show(request, response, session, out, sLoginErr, sForm, sAction,
conn, stat); %>
admin/admin<br>
guest/guest
</td>
</tr>
</table>
Output Screenshots
Default.jsp - Home Screen
• Here Admin can make changes to user accounts or can also add new
accounts.
My Classifieds
• Adv Search box search for the entries of ads in database according to
price bars and also in particular order.
Why a Classifieds Site?
In 2003, the market for online classified ads was over $100 billion according
to market researcher Classified Intelligence. In 2006 it generated revenue of
$2.1 billion