You are on page 1of 70

1.

Introduction

About Project:
City Guide is an essential whenever we are visiting a particular city. It gives us the
valuable information about the city and saves the time. Our project laid a web based platform
for the city guide and can search every place in the city without taking the help of any
personal guide. You can search a city for its prominent places of the city user, and can get
social and political information of the city, city culture, security, entertainment, Business,
Hotels, and Jobs etc. The main aim of this project services provided to the users who have
registered in the site. The services regarding to city political, historical, conventional places,
bus routes, business companies profile and jobs details.

Our project title is ‘SMART CITY’, a web-based product used to store the details of
particular city and helps all the users who just visits our website. This site also provides all
the services like Hotel booking for tourists, Ticket booking, Transport facility providing,
business related information, marketing details, city news, shopping detail. The website
contains the complete information about particular city like places to be visited, site maps
route maps, Business environment, Job portal, information about organization that transport,
Hospitality and total history of the city. This website can be used by any person who is
having general knowledge about internet. All the users will be first considered as anonymous
user later if he needs any service then he will be treated as registered user.
Overall description consists of background of the entire specific requirement. It also
gives explanation about actor and function which is used. It gives explanation about
architecture diagram and it also gives what we are assumed and dependencies. It also support
specific requirement and also it support functional requirement, supplementary requirement
other than actor which is used. It also gives index and appendices. It also gives explanation
about any doubt and queries. This system can be used as an application for the handicraft
employees and customers of the Handicraft company to manage the product information.
Customer logging should be able to upload the information of the any required product.
Customers/Company representatives logging in may also access/search any information of
product related.

1
2. Project Analysis
2.1 Purpose of the Project:

The main aim of this project services provided to the users who have registered in
the site. The services regarding to city political, historical, conventional places, bus routes,
business companies profile and jobs details. Smart city is a web-based product used to store
the details of particular city and helps all the users who just visit our website. This site also
provides all the services like Hotel booking for tourists, Ticket booking, Transport facility
providing, business related information, marketing details, city news, shopping detail. The
website contains the complete information about particular city like places to be visited, site
maps route maps, Business environment, Job portal, information about organization that
provide transport, Hospitality and total history of the city. This website can be used by any
person who is having general knowledge about internet. All the users will be first considered
as anonymous user later if he needs any service then he will be treated as registered user.
It facilitates communication between users, experts and general public through
chat/polls/mail. This will definitely help the users for the purpose of saving their valuable
time which can’t be got back which is also economically viable. This system provides a
registration form for all who wants to get the services. This can be categorized based on the
type of users. It provides different registration forms for different categories. In case of
students if they need to download any material or to get information about coaching centers
and college institutions/Incase of businessmen to get the information about any kind of
business/Incase of tourists to get the hospitality facilities/in case of jobseekers to get the
information about available job details they need to give their ID&PASSWORD for security
purpose and AC.NO only at the time of transactional providence.

2
2.2 Existing System:

In Existing system the person who are visiting a particular city need to gather
information from the person who is staying in the city or take the help of the guide in the city.
Gather of all these information you need to visit the city. This possess a lot of time and pre-
planning. In order to get each piece of information we need to go for help desk.

2.2.1 Limitations of Existing System:

 The existing system is a manual system. Here the city information needs to save his
information in the form of excel sheets or Disk Drives.

 There is no sharing is possible if the data is in the form of paper or Disk drives.

 The manual system gives us very less security for saving data; some data may be lost
due to mismanagement.

 It’s a limited system and fewer users friendly.

2.3 Proposed System:

The Proposed System provides an online information about the particular city going
to visit. It also provides additional services to the registered user. The development of this
new system contains the following activities, which try to automate the entire process
keeping in the view of database integration approach.

 User Friendliness is provided in the application with various controls provided by


system Rich User Interface.

 The system makes the overall project management much easier and flexible.

 It can be accessed over the Intranet.

 The city information files can be stored in centralized database which can be
maintained by the system.

3
3. Requirement Analysis

3.1 Purpose and Scope

Smart City is website used to provide information regarding the particular


city that includes city-map, history-social, political, business news and other services for
registered users.

Scope:

 It can be accessed by unlimited number of users.


 Each user will be assigned a different set of permissions for each module of the
system.
 The user can have access to all the information in the site with limited services
and provide extra services to registered users.
 Track all the transaction details of the customer.
 Confirmation of end user identity and will verify which users are authorized to
receive Support. Maintain history of each customer and their related Maintain
history of each customer and their related information.
 Every user must have their ID& PASSWORD for security purpose and AC.NO
for transaction purpose.
 All the job seekers must have their Resume document to submit to administrator.
 Only registered members will be provided with communication between user,
experts and general public through poll/chat/mails.
 Administrator is created in the system already.
 The administrator has to generate daily/weekly/Monthly reports, of the business
and political news of the city.
 This site is best designed to be useful through internet to people of different
places.

3.2 Users of the System


 Tourists, students, Businessmen
 Industrialists, Entrepreneur, Organizations academicians etc
 Jobseekers

4
4. Specific Requirements

4.1 Functional and Non Functional Requirements

 Functional Requirements:
 Complete-map of the city with key markets and places to see marked-preferably
usage of static map and live map option.

 Complete history of the city-social, political.

 Complete overview of the Businesses in the city.

 Secure registration of all users including a personal profile-only at the time of a


transaction providence.

 Complete Search/site map of the entire city for easy access.

 Local news, government notices, current updates of the city.

 Local language support at user-interface and database-level.

 Facilitate communication between user, experts and general public through


polls/mail/discussion forum/chat.

 Start atleast 4 paid services like SMS alerts for city news, market daily rates.

 Non-Functional Requirements:
 24*7 availability
 Better component design to get better performance at peak time
 Flexible service based architecture will be highly desirable for future extension.

4.2 User Interface Requirements


 Professional look and feel
 Browser testing and support for IE, Chrome, Mozilla, and Fire fox.

5
5. System Requirements
 HARDWARE REQUIREMENTS:
 Pentium 233HZ 80 GB HD, 1024 MB RAM (Server).
 Any P.C with Windows, 256 MB RAM (Client).
 Internet connection with 33.6 KBPS Modem.
 SOFTWARE REQUIREMENTS:
 Windows XP
 Eclipse
 JDBC ODBC 2.0 drivers installed
 Database-MySQL DB
 J2EE

Coding and Snapshots

<jsp:include page="header.jsp" />

<header>
<!--Navbar-->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top scrolling-navbar">
<div class="container">
<a class="navbar-brand" href="#">

6
<img class="img-fluid logo" src="assets/images/smart.png"
alt="Smart City">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent-7"
aria-controls="navbarSupportedContent-7" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent-7">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">City</a>
</li>

</ul>
<form class="form-inline">
<div class="md-form my-0">
<input class="form-control mr-sm-2" type="text"
placeholder="Search" aria-label="Search">
</div>
</form>
</div>
</div>
</nav>
<!-- Navbar -->
<!-- Full Page Intro -->
<div class="view">
<video src="assets/images/backv.mp4" loop muted autoplay></video>
<!-- Mask & flexbox options-->
<div class="mask rgba-gradient align-items-center">
<!-- Content -->
<div class="container">
<!--Grid row-->
<div class="row rows">
<!--Grid column-->
<div class="col-md-5 mb-5 mt-md-0 mt-5 white-text text-center
text-md-left">
<h1 class="h1-responsive font-weight-bold wow fadeInLeft"
data-wow-delay="0.3s">Bangalore
Smart City </h1>
<hr class="hr-light wow fadeInLeft" data-wow-delay="0.3s">
<h6 class="mb-3 wow fadeInLeft" data-wow-
delay="0.3s">Lorem ipsum dolor sit amet,
consectetur adipisicing elit. Rem repellendus quasi
fuga
nesciunt dolorum nulla magnam veniam sapiente, fugiat!
Commodi sequi non animi ea
dolor molestiae, quisquam iste, maiores. Nulla.</h6>
<a class="btn btn-outline-white wow fadeInLeft" data-wow-
delay="0.3s">Learn more</a>
</div>
<!--Grid column-->
<!--Grid column-->
<div class="col-md-7 col-xl-7 mb-4">
<!--Form-->

7
<div class="card card3 wow fadeInRight" data-wow-
delay="0.3s">
<div class="card-body">
<!--Header-->
<div class="login-page">
<div class="form">

<form class="register-form"
action="User_Register">
<h1 class="h1-responsive font-weight-
bold wow fadeInLeft text-white text-center"
data-wow-delay="0.3s">
Register </h1>

<hr class="hr-light wow fadeInLeft"


data-wow-delay="0.3s">

<div class="md-form">
<i class="fas fa-user prefix
white-text active"></i>
<input type="text" id="form3"
name="user_name" class="white-text form-control">
<label for="form3"
class="active">Your name</label>
</div>
<div class="md-form">
<i class="fas fa-envelope prefix
white-text active"></i>
<input type="email" id="form2"
name="user_email" class="white-text form-control">
<label for="form2"
class="active">Your email</label>
</div>
<div class="md-form">
<i class="fas fa-mobile prefix
white-text active"></i>
<input type="text" id="form5"
name="user_mobile" class="white-text form-control">
<label for="form5"
class="active">Your Mobile</label>
</div>
<div class="md-form">

<i class="fas fa-genderless


prefix white-text active"></i>
<input type="text" id="form6"
name="user_gender" class="white-text form-control">
<label for="form6"
class="active">Your Gender</label>
</div>
<div class="md-form">
<i class="far fa-calendar-alt
prefix white-text active"></i>
<input type="date" id="form8"
name="user_dob"class="white-text form-control">
<label for="form8"
class="active">Your DOB</label>
</div>

8
<div class="md-form">
<i class="far fa-address-book
prefix white-text active"></i>
<textarea id="form7"
name="user_address" class="md-textarea form-control"
rows="3"></textarea>
<label for="form7">Material
textarea</label>
</div>
<div class="md-form">
<i class="fas fa-lock prefix
white-text active"></i>
<input type="password"
name="user_password"id="form4" class="white-text form-control">
<label for="form4">Your
password</label>
</div>
<div class="text-center mt-4">
<button class="btn btn-
indigo">Save</button>
<p class="message h1-responsive
font-weight-bold">Already registered? <a
href="#"
class="text-dark h5-
responsive font-weight-bold">Login</a>
</p>
<hr class="hr-light mb-3 mt-4">
</div>

</form>
<form class="login-form"
action="User_login">
<h1 class="h1-responsive font-weight-
bold wow fadeInLeft text-white text-center"
data-wow-delay="0.3s">
Login
</h1>
<hr class="hr-light wow fadeInLeft"
data-wow-delay="0.3s">
<div class="md-form">
<i class="fas fa-envelope prefix
white-text active"></i>
<input type="email" id="form12"
name="user_email" class="white-text form-control">
<label for="form12"
class="active">Your email</label>
</div>

<div class="md-form">
<i class="fas fa-lock prefix
white-text active"></i>
<input type="password"
id="form13" name="user_password" class="white-text form-control">
<label for="form13">Your
password</label>
</div>
<div class="text-center mt-4">

9
<button class="btn btn-
indigo">Login</button>
<p class="message h1-responsive
font-weight-bold">Not registered? <a
href="#" class="text-dark
h5-responsive font-weight-bold">Create
an
account</a>
</p>
<hr class="hr-light mb-3 mt-4">
<a href="" class="text-dark" data-
toggle="modal"
data-
target="#modalLoginRest">Forgot Password</a>
</div>

</form>

</div>
</div>
</div>
</div>

<!--/.Form-->
</div>
<!--Grid column-->
</div>
<!--Grid row-->
</div>
<!-- Content -->
</div>
<!-- Mask & flexbox options-->
</div>
<!-- Full Page Intro -->
</header>
<!-- Main navigation -->
<!--Main Layout-->
<main>
<div class="container">
<!--Grid row-->
<div class="row py-5">
<!--Grid column-->
<div class="col-md-12 text-center">
<h1>About</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim
id est laborum.</p>
</div>
<!--Grid column-->
</div>

10
<!--Grid row-->
</div>
</main>
<!--Main Layout-->

<jsp:include page="footer.jsp" />


<script>
$('.message a').click(function() {
$('form').animate({
height: "toggle",
opacity: "toggle"
}, "slow")
})
</script>

Register

Register.java

package com.smart;

import java.io.IOException;

import javax.servlet.ServletException;

11
import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

/**

* Servlet implementation class User_Register

*/

@WebServlet("/User_Register")

public class User_Register extends HttpServlet {

private static final long serialVersionUID = 1L;

public void service(HttpServletRequest request , HttpServletResponse


response)

//String user_id =request.getParameter("user_id");

String user_name =request.getParameter("user_name");

String user_email =request.getParameter("user_email");

String user_mobile =request.getParameter("user_mobile");

String user_dob =request.getParameter("user_dob");

String user_gender =request.getParameter("user_gender");

String user_address =request.getParameter("user_address");

String user_password =request.getParameter("user_password");

Modal m=new Modal();

//m.setUser_id((user_id)+(m.getId()));

12
m.setUser_name(user_name);

m.setUser_email(user_email);

m.setUser_mobile(user_mobile);

m.setUser_dob(user_dob);

m.setUser_gender(user_gender);

m.setUser_address(user_address);

m.setUser_password(user_password);

int x=m.userregister();

if(x==1)

try

response.sendRedirect("/SmartCity/regsuccese.jsp");

catch (Exception e)

else if(x==-1)

try

response.sendRedirect("/SmartCity/alreadyReg.jsp");

catch (Exception e)

13
}

else

try

response.sendRedirect("/SmartCity/regerror.jsp");

catch (Exception e)

Login.java

package com.smart;

import java.io.IOException;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

/**

14
* Servlet implementation class Admin_login

*/

@WebServlet("/Admin_login")

public class Admin_login extends HttpServlet {

private static final long serialVersionUID = 1L;

public void service(HttpServletRequest request,HttpServletResponse response)

String admin_email= request.getParameter("admin_email");

String admin_password= request.getParameter("admin_password");

Modal m=new Modal();

m.setAdmin_email(admin_email);

m.setAdmin_password(admin_password);

boolean x=m.adminlogin();

String psd = m.getAdmin_password();

if(psd.equals(admin_password))

HttpSession session =request.getSession(true);

String admin_name=m.getAdmin_name();

session.setAttribute("admin_name", admin_name);

session.setAttribute("admin_email", admin_email);

if(x==true)

try

15
{

response.sendRedirect("/SmartCity/dasboard.jsp");

catch(Exception e)

e.printStackTrace();

else

try

response.sendRedirect("/SmartCity/adminfaillogin.jsp");

catch(Exception e)

e.printStackTrace();

16
Home.jsp

<jsp:include page="header.jsp" />


<!--Navbar-->

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%

String driver = "com.mysql.jdbc.Driver";


String connectionUrl = "jdbc:mysql://localhost:3306/";
String database = "smartcity";
String userid = "root";
String password = "";
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
%>
<nav class="navbar navbar-expand-lg navbar-dark indigo fixed-top scrolling-
navbar">
<div class="container">
<a class="navbar-brand" href="#">
<img class="img-fluid logo" src="assets/images/smart.png"
alt="Smart City">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent-7"
aria-controls="navbarSupportedContent-7" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent-7">

17
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">City</a>
</li>

</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#"><%
out.println(session.getAttribute("user_name"));
%></a>
</li>
<li class="nav-item">
<a class="nav-link" href="User_logout">Logout</a>
</li>

</ul>
</div>
</div>
</nav>
<!-- Navbar -->

<!------------------------------main image item-->


<div class="container" style="margin-top: 5%;">
<div class="row">

<div class="col-sm-12 pt-5">


<form id="labnol">
<h1 style="text-align: center;"> your favorite Location
search here</h1>
<div class=" form-group search-box shadow-lg col-sm-6 mx-auto
d-block ">
<i class="fas fa-search sea"></i>
<i class="fas fa-microphone micro"
onclick="startDictation()"></i>
<input class="search-txt " type="text" id="myInput"
onkeyup="myFunction()"
placeholder="Search item">

</div>

<!--------- intput----->
</form>
</div>
<!------------------colo-s-->

</div>
</div>
<div class="container">
<div class="row" id="myUL">
<%

18
try{
connection = DriverManager.getConnection(connectionUrl+database, userid,
password);
statement=connection.createStatement();
String sql ="select * from category";
resultSet = statement.executeQuery(sql);
while(resultSet.next()){
%>
<div class="col-lg-6 col-md-12 mb-4 li">
<!--Card-->
<a href="#" hidden><%=resultSet.getString("img_name") %></a>
<div class="card city-card city">

<!--Card image-->
<div class="view overlay hm-white-slight city-card">
<img src="post/<%=resultSet.getString("photo") %>"
class="img-fluid card-img-top" alt="photo">
<a href="#!">
<div class="mask"></div>
</a>
</div>

<!--Card content-->
<div class="card-body">
<!--Title-->

<h2 class="card-title text-center"><


%=resultSet.getString("img_name") %> </h2>
<!--Text-->

<div class="text-center pb-5">


<a href="viewCity.jsp?imageid=<
%=resultSet.getString("imageid") %>" class="btn btn-deep-orange btn-md">Read
more</a>
</div>

</div>

</div>
<!--/.Card-->

</div>
<!--col--->
<%
}
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
%>
</div>
</div>

<jsp:include page="footer.jsp" />


<script>
function myFunction() {
var input, filter, ul, li, a, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();

19
ul = document.getElementById("myUL");
li = ul.getElementsByClassName("li")
//li = ul.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("a")[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
</script>

20
Data base user

21
Admin Side

Admin.java

package com.smart;

import java.io.IOException;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

/**

* Servlet implementation class Admin_login

22
*/

@WebServlet("/Admin_login")

public class Admin_login extends HttpServlet {

private static final long serialVersionUID = 1L;

public void service(HttpServletRequest request,HttpServletResponse response)

String admin_email= request.getParameter("admin_email");

String admin_password= request.getParameter("admin_password");

Modal m=new Modal();

m.setAdmin_email(admin_email);

m.setAdmin_password(admin_password);

boolean x=m.adminlogin();

String psd = m.getAdmin_password();

if(psd.equals(admin_password))

HttpSession session =request.getSession(true);

String admin_name=m.getAdmin_name();

session.setAttribute("admin_name", admin_name);

session.setAttribute("admin_email", admin_email);

if(x==true)

try

23
response.sendRedirect("/SmartCity/dasboard.jsp");

catch(Exception e)

e.printStackTrace();

else

try

response.sendRedirect("/SmartCity/adminfaillogin.jsp");

catch(Exception e)

e.printStackTrace();

Add Category Page

24
package com.smart;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.InputStream;

import javax.servlet.ServletException;

import javax.servlet.annotation.MultipartConfig;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.Part;

/**

* Servlet implementation class AddPost

*/

@MultipartConfig

25
@WebServlet("/Category")

public class Category extends HttpServlet {

private static final long serialVersionUID = 1L;

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws


ServletException, IOException {

// TODO Auto-generated method stub

//doGet(request, response);

String img_name =request.getParameter("img_name");

String location =request.getParameter("location");

String description =request.getParameter("description");

Part file= request.getPart("photo");

String photo= file.getSubmittedFileName();//get selected image file name

System.out.println("select file name" +photo);

String uploadPath="F:/servlet/SmartCity/src/main/webapp/post/"+photo;//uoload
path where we have to upload our actual image

System.out.println("Upload File "+uploadPath);

Modal m=new Modal();

//m.setUser_id((user_id)+(m.getId()));

m.setImg_name(img_name);

m.setLocation(location);

m.setDescription(description);

m.setPhoto(photo);

26
int x=m.post();

try

FileOutputStream fos = new FileOutputStream(uploadPath);

InputStream is = file.getInputStream();

byte[] data = new byte[is.available()];

is.read(data);

fos.write(data);

fos.close();

catch(Exception e)

e.printStackTrace();

if(x==1)

try

response.sendRedirect("/SmartCity/succeseCatgory.jsp");

catch (Exception e)

27
}

else

try

response.sendRedirect("/SmartCity/errorCategory.jsp");

catch (Exception e)

List of Category

28
<jsp:include page="header.jsp" />
<!--Navbar-->
<!--Navbar-->
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%

String driver = "com.mysql.jdbc.Driver";


String connectionUrl = "jdbc:mysql://localhost:3306/";
String database = "smartcity";
String userid = "root";
String password = "";
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
%>

<nav class="navbar navbar-expand-lg navbar-dark indigo fixed-top scrolling-


navbar">
<div class="container">
<a class="navbar-brand" href="#">
<img class="img-fluid logo" src="assets/images/smart.png"
alt="Smart City">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent-7"
aria-controls="navbarSupportedContent-7" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>

29
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent-7">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link " href="category.jsp">Add Category</a>
</li>

<li class="nav-item">
<a class="nav-link " href="listpost.jsp">List of Post</a>
</li>
<li class="nav-item">
<a class="nav-link" href="listsubpost.jsp">List of Sub
Post</a>
</li>

</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item" >

<a class="nav-link" href=""><%


out.println(session.getAttribute("admin_name"));
%> </a>

</li>
<li class="nav-item">
<a class="nav-link text-dark"
href="Admin_logout">Logout</a>

</li>

</ul>
</div>
</div>
</nav>
<!-- Navbar -->
<div class="container" style="margin-top: 10%;">
<div class="row">
<div class="col-md-12">
<table class="table" id="datatable">
<thead>
<tr>

<th>Post name</th>
<th>Post Location</th>
<th>Description</th>
<th>Post</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<%
try{
connection = DriverManager.getConnection(connectionUrl+database, userid,
password);
statement=connection.createStatement();
String sql ="select * from category";
resultSet = statement.executeQuery(sql);
while(resultSet.next()){

30
%>

<tr>

<td><%=resultSet.getString("img_name") %></td>
<td><%=resultSet.getString("location") %></td>
<td><%=resultSet.getString("description") %></td>
<td> <img src="post/<
%=resultSet.getString("photo") %>" class=" " alt="photo" style="width:50px;
height:50px;"></td>
<td>
<a class="btn rounded-pill btn-rounded
btn-info mb-3 pl-5 pr-5 " href = "$
{pageContext.request.contextPath}/ItemController?action=EDIT&id=$
{item.id}">Edit</a>

<a class="btn rounded-pill btn-rounded


btn-warning mb-3 pl-5 pr-5" href = "addpost.jsp?imageid=<
%=resultSet.getString("imageid") %>">Add Post</a>
<a class="btn rounded-pill btn-rounded
btn-danger pl-5 pr-5" href = "${pageContext.request.contextPath}/ItemController?
action=DELETE&id=${item.id}">Delete</a>
</td>

</tr>

<%
}
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
%>

</tbody>
</table>
</div>
</div>
</div>
<jsp:include page="footer.jsp" />

Add Post

31
Addpost.java

package com.smart;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.InputStream;

import javax.servlet.ServletException;

import javax.servlet.annotation.MultipartConfig;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.Part;

/**

* Servlet implementation class Category

*/

32
@MultipartConfig

@WebServlet("/AddPost")

public class AddPost extends HttpServlet {

private static final long serialVersionUID = 1L;

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws


ServletException, IOException {

// TODO Auto-generated method stub

//doGet(request, response);

String post_name =request.getParameter("post_name");

String category =request.getParameter("category");

String post_description =request.getParameter("post_description");

Part file= request.getPart("post_photo");

String post_photo= file.getSubmittedFileName();//get selected image file name

System.out.println("select file name" +post_photo);

String
uploadPath="F:/servlet/SmartCity/src/main/webapp/post/"+post_photo;//uoload path where we
have to upload our actual image

System.out.println("Upload File "+uploadPath);

Modal m=new Modal();

m.setCategory(category);

m.setPost_name(post_name);

m.setPost_description(post_description);

m.setPost_photo(post_photo);

33
int x=m.addpost();

try

FileOutputStream fos = new FileOutputStream(uploadPath);

InputStream is = file.getInputStream();

byte[] data = new byte[is.available()];

is.read(data);

fos.write(data);

fos.close();

catch(Exception e)

e.printStackTrace();

if(x==1)

try

response.sendRedirect("/SmartCity/postSucces.jsp");

catch (Exception e)

34
}

else

try

response.sendRedirect("/SmartCity/posterror.jsp");

catch (Exception e)

List of Post

35
Add Sub Post

package com.smart;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.InputStream;

import javax.servlet.ServletException;

import javax.servlet.annotation.MultipartConfig;

36
import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.Part;

/**

* Servlet implementation class Sub_Post

*/

@MultipartConfig

@WebServlet("/Sub_Post")

public class Sub_Post extends HttpServlet {

private static final long serialVersionUID = 1L;

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws


ServletException, IOException {

// TODO Auto-generated method stub

//doGet(request, response);

String sub_post_name =request.getParameter("sub_post_name");

String post =request.getParameter("post");

Part file= request.getPart("sub_post_photo");

String sub_post_photo= file.getSubmittedFileName();//get selected image file name

System.out.println("select file name" +sub_post_photo);

37
String
uploadPath="F:/servlet/SmartCity/src/main/webapp/images/"+sub_post_photo;//uoload path
where we have to upload our actual image

System.out.println("Upload File "+uploadPath);

Modal m=new Modal();

m.setPost(post);

m.setSub_post_name(sub_post_name);

m.setSub_post_photo(sub_post_photo);

int x=m.subaddpost();

try

FileOutputStream fos = new FileOutputStream(uploadPath);

InputStream is = file.getInputStream();

byte[] data = new byte[is.available()];

is.read(data);

fos.write(data);

fos.close();

catch(Exception e)

e.printStackTrace();

38
if(x==1)

try

response.sendRedirect("/SmartCity/subpostSucces.jsp");

catch (Exception e)

else

try

response.sendRedirect("/SmartCity/subposterror.jsp");

catch (Exception e)

39
}

Modal.java

package com.smart;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.Statement;

public class Modal

Connection con=null;

PreparedStatement pstmt=null;

ResultSet res=null;

Statement st = null;

private int imageid;

private String img_name;

private String location;

private String description;

private String photo;

private int admin_id;

40
private String admin_name;

private String admin_email;

private String admin_password;

private int post_id;

private String category;

private String post_name;

private String post_description;

private String post_photo;

/*************sub post add*************/

private int sub_post_id;

private String post;

private String sub_post_name;

private String sub_post_photo;

public int getImageid() {

return imageid;

public void setImageid(int imageid) {

this.imageid = imageid;

41
public String getImg_name() {

return img_name;

public void setImg_name(String img_name) {

this.img_name = img_name;

public String getLocation() {

return location;

public void setLocation(String location) {

this.location = location;

public String getDescription() {

return description;

public void setDescription(String description) {

this.description = description;

public String getPhoto() {

return photo;

public void setPhoto(String photo) {

this.photo = photo;

public int getAdmin_id() {

42
return admin_id;

public void setAdmin_id(int admin_id) {

this.admin_id = admin_id;

public String getAdmin_name() {

return admin_name;

public void setAdmin_name(String admin_name) {

this.admin_name = admin_name;

public String getAdmin_email() {

return admin_email;

public void setAdmin_email(String admin_email) {

this.admin_email = admin_email;

public String getAdmin_password() {

return admin_password;

public void setAdmin_password(String admin_password) {

this.admin_password = admin_password;

public int getPost_id() {

return post_id;

43
}

public void setPost_id(int post_id) {

this.post_id = post_id;

public String getCategory() {

return category;

public void setCategory(String category) {

this.category = category;

public String getPost_name() {

return post_name;

public void setPost_name(String post_name) {

this.post_name = post_name;

public String getPost_description() {

return post_description;

public void setPost_description(String post_description) {

this.post_description = post_description;

public String getPost_photo() {

return post_photo;

public void setPost_photo(String post_photo) {

this.post_photo = post_photo;

44
}

public int getSub_post_id() {

return sub_post_id;

public void setSub_post_id(int sub_post_id) {

this.sub_post_id = sub_post_id;

public String getPost() {

return post;

public void setPost(String post) {

this.post = post;

public String getSub_post_name() {

return sub_post_name;

public void setSub_post_name(String sub_post_name) {

this.sub_post_name = sub_post_name;

public String getSub_post_photo() {

return sub_post_photo;

public void setSub_post_photo(String sub_post_photo) {

this.sub_post_photo = sub_post_photo;

45
/*********************User Login******************/

private int user_id;

private String user_name;

private String user_email;

private String user_mobile;

private String user_dob;

private String user_gender;

private String user_address;

private String user_password;

public int getUser_id() {

return user_id;

public void setUser_id(int user_id) {

this.user_id = user_id;

public String getUser_name() {

return user_name;

public void setUser_name(String user_name) {

this.user_name = user_name;

46
public String getUser_email() {

return user_email;

public void setUser_email(String user_email) {

this.user_email = user_email;

public String getUser_mobile() {

return user_mobile;

public void setUser_mobile(String user_mobile) {

this.user_mobile = user_mobile;

public String getUser_dob() {

return user_dob;

public void setUser_dob(String user_dob) {

this.user_dob = user_dob;

public String getUser_gender() {

return user_gender;

public void setUser_gender(String user_gender) {

this.user_gender = user_gender;

public String getUser_address() {

return user_address;

47
public void setUser_address(String user_address) {

this.user_address = user_address;

public String getUser_password() {

return user_password;

public void setUser_password(String user_password) {

this.user_password = user_password;

/******************user register end*******************/

String url="jdbc:mysql://localhost/smartCity?useSSL=false&serverTimezone=UTC";

String unn="root";

String pwd="";

Modal()

try

DriverManager.registerDriver(new com.mysql.jdbc.Driver());

con=DriverManager.getConnection(url,unn,pwd);

catch(Exception e )

e.printStackTrace();

48
int userregister()

try {

String ss= "SELECT * FROM user where user_email=?";

pstmt = con.prepareStatement(ss);

pstmt.setString(1, user_email);

res = pstmt.executeQuery();

if(res.next()==false)

String s="INSERT INTO user VALUES(?,?,?,?,?,?,?,?)";

pstmt=con.prepareStatement(s);

pstmt.setInt(1, user_id);

pstmt.setString(2, user_name);

pstmt.setString(3, user_email);

pstmt.setString(4, user_mobile);

pstmt.setString(5, user_dob);

pstmt.setString(6, user_gender);

pstmt.setString(7, user_address);

pstmt.setString(8, user_password);

int x=pstmt.executeUpdate();

return x;

else

return -1;

49
}

catch (Exception e) {

e.printStackTrace();

return 0;

//*********************************Login Module*************

boolean userlogin()

try

String s="SELECT * FROM user WHERE user_email =? AND


user_password =?";

pstmt=con.prepareStatement(s);

pstmt.setString(1, user_email);

pstmt.setString(2, user_password);

res=pstmt.executeQuery();

while(res.next()==true)

user_email=res.getString(3);

user_password=res.getString(8);

user_name=res.getString(2);

return true;

50
}

catch(Exception e)

System.out.println("Some problem in Model");

return false;

/************************End userModal*******************/

//*********************************Admin Module*************

boolean adminlogin()

try

String s="SELECT * FROM admin WHERE admin_email =? AND


admin_password =?";

pstmt=con.prepareStatement(s);

pstmt.setString(1, admin_email);

pstmt.setString(2, admin_password);

res=pstmt.executeQuery();

while(res.next()==true)

admin_email=res.getString(3);

admin_password=res.getString(4);

admin_name=res.getString(2);

51
return true;

catch(Exception e)

System.out.println("Some problem in Model");

return false;

int post()

try

String s="INSERT INTO category VALUES(?,?,?,?,?)";

pstmt=con.prepareStatement(s);

pstmt.setInt(1, imageid);

pstmt.setString(2, img_name);

pstmt.setString(3, location);

pstmt.setString(4, description);

pstmt.setString(5, photo);

int x=pstmt.executeUpdate();

return x;

52
catch (Exception e)

e.printStackTrace();

return 0;

int addpost()

try

String s="INSERT INTO addpost VALUES(?,?,?,?,?)";

pstmt=con.prepareStatement(s);

pstmt.setInt(1, post_id);

pstmt.setString(2, category);

pstmt.setString(3, post_name);

pstmt.setString(4, post_description);

pstmt.setString(5, post_photo);

int x=pstmt.executeUpdate();

return x;

catch (Exception e)

e.printStackTrace();

53
return 0;

int subaddpost()

try

String s="INSERT INTO subpost VALUES(?,?,?,?)";

pstmt=con.prepareStatement(s);

pstmt.setInt(1, sub_post_id);

pstmt.setString(2, post);

pstmt.setString(3, sub_post_name);

pstmt.setString(4, sub_post_photo);

int x=pstmt.executeUpdate();

return x;

catch (Exception e)

e.printStackTrace();

return 0;

54
Database

Admin

Category Database

Post Database

55
Sub Post Database

Description:

Name of the Use Case: City Information

Description:

Every user can directly access the website and visualize all the Information in the site.
Pre-Condition: No pre condition exists

Post condition: Home Page will be displayed.

Flow of events:

 Invoke the home page.


 Views the Required information pages.
 Click on register to get registration.
 Access required services through sign up into account.
Name of the Use Case: Reports

Description:

Every user can directly access the website and see all information in the reports.

Pre-Condition: Click on Reports in home page

56
Post condition: Reports Page will be displayed.

Flow of events:

 Invoke the home page.


 Views the reports generated by administrator
 Click on jobs to view jobs
 Click on business
Name of the Use Case: Services

Description:

Every user can directly access the website and visualize all the services only after
registration.

Pre-Condition: First register and Login with user_id and click services button

Post condition: select the required service you will.

Flow of events:

 Invoke the home page.


 Login through UserId and password.
 Click on services in your home page.
 Click the required service you choose.

6.2.2 Class Diagram: A class diagram is an illustration of the relationships and


source code dependencies among classes in the unified modeling language. In this context, a
class defines the methods and variables in an object, which is a specific entity in a program or
the unit of code representing that entity.

6.2.3 Collaboration Diagram : A collaboration diagram also called a communication


diagram or interaction diagram is an illustration of the relationships and interactions among
software objects in the unified modeling language.

57
1: Inval id()

:Login

2: View Social
3: View Political

4: View News ,tvChannels


8: View Em ergency
:His tory
:City
Particulars

5: view Places
Places
9: Hotels
7: Vi ew Hotels

12:
6: View Logout
Bus routes
:Hotels

10: View Bus

:Bus
:Logout Routes

11: Logout()

11: Pay fee


Student Institute
s
1: Login
2: Search for course
6: Select Course
8: Select Institutes
10: Display fee and Duration
12: Acknowledgemant
9: Request Fee
4: Notify()

5: Display Courses
7: Display Institutes
Data Window
Base
3: Request

58
3: Acknowledgement()
Data
Admin Hotel
Base
Management
2: Update() 1: Send Updates()
5: Update() 9: Acknowledgement()
8: Update()
4: Send Updates()
7: Send Updates()
6: Acknowledgement()
Colleges &
Institutes

Compani
es

Fig 6.2.3(c) Admin Update Collaboration Diagram

1: Login
2: Request for site details 3: forwards to Admin
Business Window Admin
person
4: Send Reply

Fig 6.2.3(c) Business Person Collaboration Diagram

6.2.4 Sequence Diagram: Sequence diagram is a diagram that shows object


interactions arranged in time sequence. In particular it shows objects participating in the
interaction and the sequence of messages exchanged.

59
:Login :History :City Particulars Places :Hotels :Bus Routes :Logout

1: Invalid()

2: View Social

3: View Political

4: View News,tvChannels
5: view Places
6: View Busroutes

7: View Hotels

8: View Emergency

9: Hotels
10: View Bus
11: Logout()

12: Logout

Fig 6.2.4(a) Sequence Diagram of the User

Businessperson Window Admin

Login

Request for site details


forwards to Admin

Send Reply

Fig 6.2.4(b) Business Person Sequence Diagram

60
DataBase Admin Hotel Companies Colleges &
Management Institutes

Send Updates()
Update()
Acknowledgement()

Send Updates()
Update()
Acknowledgement()

Send Updates()
Update()
Acknowledgement()

Fig 6.2.4(c) Admin Site Update Sequence Diagram

61
Student Window DataBase Institutes

Login

Search for course Request


Notify()

Display Courses
Select Course
Display Institutes

Select Institutes
Request Fee

Display fee and Duration

Pay fee

Acknowledgemant

Fig 6.2.4(d) Course Registration Sequence Diagram

6.2.5 Activity Diagram: Activity diagram describes various activities that takes places given
in a particular process. The administrator activity diagram describes how the admin
performs various activities in order to provide various services to the different types of
users.The user activity diagram how the user will interact with the system and also various
services that are accessible by him.

62
6.3 System Specific Module
There are five modules in our project .They are listed below with their description.

1. Administrator Module
2. Tourist Module
3. Student Module
4. Businessman Module
5. Jobseeker module

1.Administrator Module: The admin module is the major module as it is responsible for
carrying out the major operations regarding site updates,business updates ,job alerts etc., It
maintains information regarding other four modules.The various software components in
administrator module update alerts, update industries, update hotels, view resumes,update
,site information. The details regarding complete history such as political and social is
entered by admin and he want he can edit the details once entered.The details regarding
business details such as top companies in the city and its information are entered and he want
he can edit the details once entered.The details regarding job details such as job title,
vacancies and companies profile is entered by admin and he can edit the details once entered.

The details regarding regarding emergency such as phone numbers of with respect to
emergency is entered by admin and he can edit the details one he entered.The details
regarding regarding conventional places such as description an,location,address and image of
the place entered by him and he can edit the details once entered

The details regarding news papers, city channels such which papers are available in the city
entered by admin and he can edit the details once he entered.The details regarding political
leaders entered by admin and he can edit the details once he entered.

2. Tourist Module : Tourist module is maintaining the information regarding the city tourist
spot, hotels in the city entertainment in this city etc..,the user after registration as a tourist is
considered as authorized user. The various software components in the tourist module are
view theaters,vie hotels,view citymap,view ATM locations,view hospitals,view city
history,view travel agency,view bus routes.

3.Jobseeker Module : Jobseeker module is the commercial module as it need some paid
services. The Jobseeker views the jobs portal and find a job availability. He then post his
resume to administrator. The various software components available in the jobseeker module

63
are view jobs, view city information, view institutes, view cityupdates,post resume,view
alerts,view city location.

4.Businessman Module: businessman module consists of information regarding various


business in the city,industries in the city, with social and political influence of the city. The
various software components in the businessman module are view cityhistory, view view
markets, view alerts, view industries, view hotels, view labour, view hotels, view labour,
view jobs.

5. Student Module: The student module maintains the various information regarding various
institutes in the city. The various components in software are view library, view books, view
institutes, view engineering colleges, view coaching centers, view journals.

The list of the software components involved in our project are explained below.

a)ViewMap: It displays the city map of the particular city by redirecting to google map and
thus achieve to give the dynamic map.

b)InsertAlerts: Insert alerts into the database .This is used to give time to time alersts to the
user.

c)viewProfile: It display the information regarding different users who have registered.

d)busearch: It provides the information regarding bus and timings if you give the source
and destination.

e)viewAlerts: It provides the alerts that are stored in database.

f)Registration: Provides registration facilities to different types of user.

g)viewIndustries: It provides information regarding their location and address with some
more description attributes.

h)viewHospitals: It provides the information regarding hospitals in the city.

i)Photogallery: It provides different photos sight seeing places in the city.

j)viewCityguide:It provide the city historical information with the static city map locating
key places in the city.

64
k)add emergency: insert emergency reports into the data base. It provides emergency
services that is needed by the user.

l)Insert Industry: it adds the information of industries in the database which provides the
business person to see the number of industries in the city along with their description.

m)Downloads: It provides various information downloads that is needed to be downloaded


by redirecting to best download site.

n)Logivalid: it validates the userid & password.

o)viewresume: The admin will view the resume posted by the user or jobseeker and forward
to an organization.

p)flight Search: it provides the information regarding flights the arrival and departure times.

q)viewIndustries:It provides information regarding their location and address with some
more description attributes.

r)viewHospitals: It provides the information regarding hospitals in the city.

s)Photogallery: It provides different photos sight seeing places in the city.

t)viewCityguide:It provide the city historical information with the static city map locating
key places in the city.

u)add emergency: insert emergency reports into the data base. It provides emergency
services that is needed by the user.

v)Insert Industry: it adds the information of industries in the database which provides the
business person to see the number of industries in the city along with their description.

w)Downloads: It provides various information downloads that is needed to be downloaded


by redirecting to best download site.

x)ViewMap: It displays the city map of the particular city by redirecting to google map and
thus achieve to give the dynamic map.

y)InsertAlerts: Insert alerts into the database .This is used to give time to time alersts to the
user.

65
Data Base Tables : The database tables available in our project implementation are

listed below.

Snapshots
6.5 Test Cases

Test case Number:1 Program: Registeration.jsp

Sl. Test Case Input Expected Output Actual Valid/Invalid


No Name Output

1 Email_id Sriram.mail.com Mail id should be in Id mail Invalid


value the format of entered
sriram@gmail.com is
invalid

sriram@gmail.com Mail id is in the form Valid valid


of mail id
sriram@gmail.com

Test case Number:2 Program: Different home page.jsp

Sl.No Test case Input Expected Actual Valid/output


Name Output Output

1 UserId and Sriram has Student If went Invalid


password registered as home page tourist home
student should be page invalid
opened

66
Sriram has Student If went to Valid
registered as Home page student
student must be home
didplayed pagess

Test case no:3 Program:goDifferentpage.jsp

Sl.No Test case Input Expected Actual Valid/output


Name Output Output

1 UserId and Sriram has Tourist If went Invalid


password registered as home page student
tourist should be home page
opened invalid

Sriram has Tourist must If went to Valid


registered as be displayed touristss
torist home pagess

Testcase:4 Program:Registration.jsp

Sl.No Test case Input Expected Actual Valid/output


Name Output Output

1 Random A random If wrong If it allows to Invalid


code value number is number is store
generated to entered
fill in form

67
A random If correct If it generate Valid
number is number is another one
generated to entered
fill in form

Testcase:5 Program:addAlert.jsp

Sl.No Test case Input Expected Actual Valid/output


Name Output Output

1 Should enter Alert id and Should not If submitted Invalid


three fields alertname is submit alerts with out
entered description

All the three Should If submitted Valid


alert fields submit the
given alerts

68
6.6 Appendix A - Hardware and Software Configurations

 HARDWARE REQUIREMENTS:
 Pentium 233HZ 80 GB HD, 1024 MB RAM (Server).
 Any P.C with Windows, 256 MB RAM (Client).
 Internet connection with 33.6 KBPS Modem.
 SOFTWARE REQUIREMENTS:
 Windows XP
 Eclipse
 JDK 1.5,web server running on any platform
 JDBC ODBC 2.0 drivers installed
 Database-Oracle10G
 J2EE,AJAX,XML

69
6.8. Appendix C-Limitations and Enhancements

Limitations:

 Use of Smartcity may cause certain problems such as danger of hacking


personal information such as name, address, account number etc.
 Security is another limitation in case of smartcity
 Online banking can be difficult to learn for a beginner.
Enhancements:

 Live MAP option can be implemented.


 Implementations of J2ME to provide high security are enhancements required.
 Good maintainence of accounts.

6.9 Appendix D-Bibliography

Text Book References :

The following books and manuals provided a lot of help to us in making this project a
reality.

 The complete Reference Java2 By Patrick Naughton and Herbert Schildt, TMH
Publishing Company Ltd.
 Java How To Program By H.M.Dietel and P.J.Dietel,Pearson Education/PHI
 Data Base Management Systems,Raghurama Krishnan, Johannes Gerhrke,TATA
McGraw-Hill
 Software Engineering By Roger S.Pressman,McGraw Hill International Edition
Pressman

70

You might also like