SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Downloaden Sie, um offline zu lesen
Page | 1
ONLINE ATTENDANCE SYSTEM
A PROJECT REPORT
Submitted by
AKASH KU. SINHA-1201297077
RAKESH KU. SAHOO-1201297074
ARPITA PRIYADARSHINEE-1201297073
SAIPRIYA MOHAPATRA-1201297076
Department of Computer Science & Engineering
Under the guidance of
PROF. SAKTI CHARAN PANDA
HOD, Asst. Professor, Department of CSE
Nalanda Institute of Technology
In partial fulfillment for the award of the degree
Of
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE & ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
NALANDA INSTITUTE OF TECHNOLOGY, BHUBANESWAR
BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ROURKELA
Page | 2
APRIL 2016
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
NALANDA INSTITUTE OF TECHNOLOGY
BHUBANESWAR
CERTIFICATE
This is to certified that the seminar report “ONLINE ATTENDANCE SYSTEM”
being submitted by AKASH KU. SINHA, ARPITA PRIYADARSHINEE,
RAKESH KU. SAHOO, SAIPRIYA MOHAPATRA bearing registration
number: 1201297077, 73, 74, 76 respectively in partial fulfillment of requirement
for the award of degree of Bachelor in Technology in CSE is a bonafide work
carried out under my/our supervision.
Prof. Sakti Charan Panda
Head Of the Department, CSE
Nalanda Institute of Technology
Chandaka, Bhubaneswar
Prof. Sakti Charan Panda
HOD, Asst. Professor
Department of CSE
Page | 3
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
NALANDA INSTITUTE OF TECHNOLOGY
BHUBANESWAR
CERTIFICATE
This is to certify that AKASH KU. SINHA, ARPITA PRIYADARSHINEE,
RAKESH KU. SAHOO, SAIPRIYA MOHAPATRA bearing registration number
1201297077, 73, 74, 76 has successfully presented their project on “ONLINE
ATTENDANCE SYSTEM” in the presence of the undersigned dignitaries. Their
skill set, knowledge on software and sincere effort has contributed towards
successful completion of the project.
Prof. Sakti Charan Panda
HOD, CSE
Nalanda Institute of Technology
Chandaka, Bhubaneswar
EVALUATORS
Nalanda Institute of Technology
Bhubaneswar
Page | 4
ACKNOWLEDGEMENT
We take this opportunity with much pleasure to thank all the people who have helped me
through the course of my journey towards producing this project. I sincerely thank my thesis
guide, Prof. SAKTI CHARAN PANDA for his guidance, help and motivation. Apart from the subject
of my research, I learnt a lot from him, which we are sure will be useful in different stages of our
life. I would like to express my gratitude to our HOD Prof. Sakti Charan Panda for his review and
many helpful comments.
We are especially grateful to our colleagues for their assistance, criticisms and useful insights. I
am thankful to all the other students of Nalanda Institute of Technology, Bhubaneswar with
whom I share tons of fun memories. I would like to acknowledge the support and encouragement
of my friends. My sincere gratitude also goes to all those who instructed and taught me through
the years.
Finally, this thesis would not have been possible without the confidence, endurance and support
of my family. My family has always been a source of inspiration and encouragement. I wish to
thank my parents, whose love, teachings and support have brought me this far.
Akash ku. Sinha-1201297077
Rakesh ku. Sahoo-1201297074
Arpita Priyadarshinee-1201297073
Saipriya Mohapatra-1201297076
Department of CSE
Page | 5
CONTENTS
SL. NO. TOPIC PAGE NO.
1. INTRODUCTION 6
2. FEASIBILITY STUDY 6
3. HARDWARE AND SOFTWARE REQUIREMENTS 7
4. MYSQL DATABASE 8
5. DISADVANTAGE OF CURRENT WORKING SYSTEM 9
6. CHARACTERISTICS OF PRTOPOSED SYSTEM 10
7. ANALYSYS 11
8. DATA FLOW DIAGRAMS 12
9. E-R DIAGRAM 16
10. JAVA SERVER PAGES(JSP) 18
11. THE CODINGS 46
12. THE DATABASE TABLES 54
13. THE SNAPSHOTS OF OUR PORTAL 58
14. CONCLUSION 63
15. BIBLIOGRAPHY 64
Page | 6
INTRODUCTION
This project attempts to develop an Online Student Attendance Management System to
illustrate the Online Service Using Stored Information. This online system is based on three tier
client server application model. Manual control of attendance is time consuming and not
effective. This project is intended to produce an automated solution for attendance
management. Using this online system, daily attendance of students in schools and colleges can
be easily managed. Also, teachers can manage the fine imposed, the notices and internal results
of each student and the faculty profiles in an efficient manner. This online system also helps the
parents to track the progress of their children using the online messaging facility. The faculties
regularly send all the internal marks and the attendance sheet of the students to their parents so
that they can know the activities of their children.
Objective of the Project –
Our aim is to make an online system which is quick easy going and encompasses all information
that a student need right from viewing the internal marks, to practical marks for all subjects of
the current semester. A user-id and password is provided to all the students. By using the user-
id and password the students can view the marks. The main objective of the project is to bridge
the communication gap and build a strong well managed communication system to avoid miss-
management and dissatisfaction.
FEASIBILITY STUDY
1. Economically Feasibility:
The system being developed is economic with respect to School or Collage’s point of view. It is
cost effective in the sense that has eliminated the paper work completely.
The system is also time effective because the calculations are automated which are made at the
end of the month or as per the user requirement.
The result obtained contains minimum errors and are highly accurate as the data is required.
Page | 7
2. Technical feasibility:
The technical requirement for the system is economic and it does not use any other additional
Hardware and software.
3. Behavioral Feasibility:
The system working is quite easy to use and learn due to its simple but attractive interface. User
requires no special training for operating the system.
HARDWARE / SOFTWARE REQUIREMENTS
 Hardware Specifications
HTML, PHP and Java Script are platform independent and it will work on all configurations
but to get efficiency through web it is recommended to use advance configuration base
machine.
Hardware Used:
o Microprocessor : Intel i3
o System Bus Speed : 533 MHz
o Processor Speed : 2.0 GHz
o Main Memory : 256 MB
o Secondary Memory : 80 GB
o Secondary Memory Speed : 1024 MHz
o CPU Capacity : 1.7 GHz
o RAM Capacity : 4 GB
 Network Specification
Server Configuration: Apache Server (web)
 Software Specifications
o Operating System: Independent
o Front End: HTML, CSS, Bootstrap
Page | 8
o Web browser: Internet Explorer, Mozilla, Netscape, Google Chrome, opera, etc.
o Back End: MySql
o Other Supporting Software: Scripting language: - jQuery, Javascript,
MySQL DATABASE
The MySQL database has become the world's most popular open source database because of its
consistent fast performance, high reliability and ease of use. It's used round the globe by
individual Web developers as well as many of the world's largest and fastest-growing
organizations with optimum resources powering their high-volume Web sites, business-critical
systems and packaged software -- including industry leaders such as Yahoo!, Alcatel-Lucent,
Google, Nokia, YouTube, and Zappos.com.
Not only is MySQL the world's most popular open source database, it's also become the database
of choice for a new generation of applications built on the LAMP stack (Linux, Apache, MySQL,
PHP / Perl / Python.) MySQL runs on more than 20 platforms including Linux, Windows, OS/X,
HP-UX, AIX, Netware, giving you the kind of flexibility that puts you in control.
As of April 2009, MySQL offers MySQL 5.1 in two different variants: the MySQL Community
Server and Enterprise Server. They have a common code base and include the following features:
 A broad subset of ANSI SQL 99, as well as extensions
 Cross-platform support
 Stored procedures
 Triggers
 Cursors
 Updatable Views
 True Varchar support
 Information schema and many more.
Page | 9
MySql implements the following Distinguishing features, which some other RDBMS systems may
not:
 Multiple storage engines, allowing one to choose the one that is most effective for each
table in the application (in MySQL 5.0, storage engines must be compiled in; in MySQL
5.1, storage engines can be dynamically loaded at run time)
 Native storage engines (MyISAM, Falcon, Merge, Memory (heap), Federated, Archive,
CSV, Blackhole, Cluster, Berkeley DB, EXAMPLE, and Maria)
 Partner-developed storage engines (InnoDB, solidDB, NitroEDB, Infobright) Community-
developed storage engines (memcached, PBXT, Revision Engine) Custom storage engines
 Commit grouping, gathering multiple transactions from multiple connections together to
increase the number of commits per second.
DISADVANTAGES OF PRESENT WORKING SYSTEM
 Not User Friendly: The existing system is not user friendly because the retrieval of
data is very slow and data is not maintained efficiently.
 Difficulty in report generating: We require more calculations to generate the report
so it is generated at the end of the session. And the student not get a single chance to
improve their attendance
 Manual control: All calculations to generate report is done manually so there is
greater chance of errors.
 Lots of paperwork: Existing system requires lot of paper work. Loss of even a single
register/record led to difficult situation because all the papers are needed to generate
the reports.
 Time consuming: Every work is done manually so we cannot generate report in the
middle of the session or as per the requirement because it is very time consuming.
Page | 10
CHARACTERSTIC OF THE PROPOSED SYSTEM
 User Friendly: The proposed system is user friendly because the retrieval and storing
of data is fast and data is maintained efficiently. Moreover the graphical user interface
is provided in the proposed system, which provides user to deal with the system very
easily.
 Reports are easily generated: reports can be easily generated in the proposed system
so user can generate the report as per the requirement (monthly) or in the middle of
the session. User can give the notice to the students so he/she become regular.
 Very less paper work: The proposed system requires very less paper work. All the data
is feted into the computer immediately and reports can be generated through
computers. Moreover work become very easy because there is no need to keep data
on papers.
 Computer operator control: Computer operator control will be there so no chance of
errors. Moreover storing and retrieving of information is easy. So work can be done
speedily and in time
ANALYSIS
 Functional Requirements:
The college portal management system is an approach towards bridging the communication gap
between the students and the college authority and making an automated system, time saving
and user-friendly. The present manual system being time consuming and inconsistent tedious,
may even bring about dissatisfaction and miss-management. The proposed system avoids all
these problems and gives easy and simple solution to all these problems.
After studying and analyzing we concluded that the following details of the software are required.
The pictorial representation is the best way to represent the collection of data at the time of
analysis and represents in the form of DFD (Data Flow Diagram), ERD (Entity Relationship
Diagram) etc. The pictorial representation provides better understandable approach for
development.
Page | 11
 Data flow Diagram
A dataflow diagram is a graphical representation that depicts information flow and the transform
that are applied as data move from input and output. The basic forms of a Data Flow Diagram
also move from known as a Data Flow Graph or a Bubble Chart. The data flow diagram (DFD)
shows the functional relationships of the values computed by a system including input values and
output values and internal data store. A data flow diagram is graph showing the flow of data
values.
In 0-level DFD shows how a visitor can register and how the registered user can login to the
software and access various options.
The level-1 DFD shows that a visitor enters the registration details and these details are verified.
The new registration details are send to the database registered user and the username is given
to the visitor. Registered user can directly login with his/her username and process the options
but if the user enters any incorrect username or password then he/she has to re-enter.
Types of Data Flow Diagram:
o Logical Data Flow Diagrams
o Physical Data Flow Diagrams
 External Entity:
The External Entity symbol represents sources of data to the system, or destinations of data
from the system. i.e. a Person, a System, or an organization that sends or receives data.
 Data flow symbol:
The Data Flow symbol represents movement of data.
 Data Store Symbol:
The Data Store symbol represents data that is saved on some file or in a table in the database.
 Process Symbol:
The Process symbol represents an activity that transforms or manipulates the data (A
process transforms incoming data flow into outgoing data flow).
Page | 12
DATA FLOW DIAGRAM:
VIEW STUDENT LIST
VIEW FINE LIST
VIEW ATTENDANCE SHEET
(DFD LEVEL 0)
STUDENT
ONLINE
ATTENDANCE
SYSTEM
ADMIN
FACULTY
ATTENDANCE ENTRY
REPORT GENERATION
ADD STUDENTS
MARKS ENTRY
Page | 13
LOGIN PROCESS (LEVEL-1 DFD)
LOGIN
INTERFACE
LOGIN
VALIDATION
USER HOME
LOGIN
VALID USER
LOG NAME
AND
PASSWORD
INVALID USER
TRY AGAIN
LOGIN NAME
AND
PASSWORD
Index.jsp
Login.jsp
Page | 14
LOGIN NAME
INTERFACE
LOGIN
STUDENT
CHECK LOGIN
NAME
REGISTRATION
PROCESS
REGISTERED
USER
LOGIN NAME
LOGIN NAME,
PASSWORD
REGISTRATION PROCESS (LEVEL-1 DFD)
Page | 15
FACULTY ACTIVITY (LEVEL-2 DFD)
An Entity Relationship Diagram Description: -
FACULTY
HOME
FACULTY
PROFILE
MANAGEMENT
SUBJECT VIEWATTENDANCE
MANAGEMENTFINE VIEW
VIEW STUDENT
STUDENT
FINE ATTENDANCE
SUBJECT
FACSUBJECT
REGISTERED FACULTY
Page | 16
E-R diagram is one of the pictorial representation in which the meaningful relationships are
entitled between various entities. It represents the real world application. The relationship is
used in data modeling to represent an association between entities. This association has certain
characteristic properties represented by the attributes of the relationship set.
Page | 17
LOGIN
HAS
A
STUDENTADMIN
APPROVES
FACULTY
DEPARTMENT SUBJECT
FACULTY SUBJECT
ATTENDANCE
FINE
ENTERS
ENTERS
HAS
A
HAS
A
HAS
A
VIEW
VIEW
Page | 18
JAVA SERVER PAGES (JSP)
It is a technology used to create dynamic webpage. Java Server Pages is a Java-based
technology that simplifies the process of developing dynamic web sites. With JSP, web designers
and developers can quickly incorporate dynamic elements into web pages using embedded java.
JSP files contain traditional HTML along with embedded code that allows the page designer to
access data from java code running on the server.
Based on the Java programming language, Java Server Pages offers proven portability,
open standards, and mature re-usable component model .The Java Server Pages architecture
enables the separation of content generation from content presentation. This separation not
eases maintenance headaches; it also allows web team members to focus on their areas of
expertise. Now, web page designer can concentrate on layout, and web application designers on
programming, with minimal concern about impacting each other’s work.
To make creation of dynamic content easier, Sun introduced Java Server Pages (JSP).
While writing served developer require a pretty extensive knowledge of Java, a person who is
new to the java can learn some pretty neat tricks in JSP in a snap. JSP represents an attractive
alternative of Microsoft’s ASP (Active Server Pages). JSP provides the HTML designer with a way
to access data and business logic stored inside Java objects without having to master the
complexities of Java application development.
When a user will access a servlet, then the runtime environment or web container
executes the servlet in servlet engine, but when a jsp is accessed by the user, then the web
container extracts the java code available within the jsp file and creates a servlet, then the web
container compiles (by jasper) & executes (by catalina) the created servlet in the servlet
container. Once the servlet is executed then the web server collects the data/output of the
servlet and embed the o/p of the servlet within html tag of the jsp file to send the response back
to the user.
Page | 19
The web server will not throw away the servlet created during the first request of the
user, rather the web server will store the servlet in cache memory to process the request of
subsequent users. In case of servlet, the html code is written within the java syntax i.e. within
println() but in case of jsp, the java code is written within scriptlet <% %> tag or we can say the
java code will be written along with html tag.
Although servlets are powerful web components, they are not ideal technology available
to us to build presentation elements. This is because:--
1) Amending the look and feel of the system involves recompiling the Servlet classes.
2) The presence of HTML within the Servlet tightly couples the presentation and the content,
which blurs the role of presentation and providing content.
Lots of HTML code within the Servlet classes makes them difficult to maintain, Java Server pages
addresses these problems. JSP are text files similar to HTML files but have extra tags that allow
us to:
 Interact with dynamic content.
 Include content from other web application resources.
 Forward the response to other web application resources.
Benefits of JSP:
 As a Java-based Technology, it enjoys all the advantages that the java language provides
with respect to development and deployment.
 As an Object Based Language with a strong typing encapsulation, exception handling, and
automatic memory management, use of Java leads to increase programmer productivity and
more robust code.
 Because compiled Java byte code is portable across all platforms that support JVM, use
of JSP does not lock you into using specific hardware platform, operating system, or server
software.
 JSP is vendor- neutral, developers and system architects can select best-of-breed
solutions at all stages of JSP deployment.
Page | 20
 JSP can readily take advantages of the other entire standard Java API’s including those for
cross-platform database access, directory services, distributed computing and cryptography.
 Provides support for a re-usable component such as Java-Beans Technology.
 It provides the easy way to develop the code as compared to Servlet Technology of the
Java.
Quite a lot of things happen behind the scene when a JSP page is deployed in a web container
and is first served to a client request.
Features of JSP
 Portability: Java Server Pages files can be run on any web server or web-enabled
application server that provides support for them. Dubbed the JSP engine, this support
involves recognition, translation, and management of the Java Server Page lifecycle and
its interaction components.
 Components: It was mentioned earlier that the Java Server Pages architecture can
include reusable Java components. The architecture also allows for the embedding of a
scripting language directly into the Java Server Pages file. The components current
supported include Java Beans and Servlets.
 Processing: A Java Server Pages file is essentially an HTML document with JSP scripting
or tags. The Java Server Pages file has a JSP extension to the server as a Java Server Pages
file. Before the page is served, the Java Server Pages syntax is parsed and processed into
a Servlet on the server side. The Servlet that is generated outputs real content in straight
HTML for responding to the client.
 Access Models: A Java Server Pages file may be accessed in at least two different ways.
A client’s request comes directly into a Java Server Page. In this scenario, suppose the
page accesses reusable Java Bean components that perform particular well-defined
computations like accessing a database. The result of the Beans computations, called
result sets is stored within the Bean as properties. The page uses such Beans to generate
dynamic content and present it back to the client. In both of the above cases, the page
Page | 21
could also contain any valid Java code. Java Server Pages architecture encourages
separation of content from presentation.
Life cycle of JSP:
A JSP life cycle can be defined as the entire process from its creation till the destruction which is
similar to a servlet life cycle with an additional step which is required to compile a JSP into servlet.
The following are the paths followed by a JSP
The four major phases of JSP life cycle are very similar to Servlet Life Cycle and they are as follows:
 JSP Compilation/ Translation Phase: In this phase the JSP page is transformed into a Java
Servlet and then compiled. This phase occurs only once for each JSP page must be
executed before the JSP page is served. When a browser asks for a JSP, the JSP engine
first checks to see whether it needs to compile the page. If the page has never been
compiled, or if the JSP has been modified since it was last compiled, the JSP engine
recompiles the page. The compilation process involves three steps:
 Implementation class: The translation phase results in a delay when a JSP page is
requested for the first time. To avoid this delay, JSP pages can be precompiled before they
are deployed using tools that perform the translation phase when the server starts up.
 JSP Initialization: When a container loads a JSP it invokes the jspInit() method before
servicing any requests. If you need to perform JSP-specific initialization, override the
jspInit() method:
public void jspInit(){
// Initialization code...
}
Compilation Initialization Execution Cleanup
Parsing the JSP
Turning the JSP into a
servlet
Compiling the servlet
Page | 22
Typically initialization is performed only once and it is s similar to init() of Servlet, you
generally initialize database connections, open files, and create lookup tables in the jspInit
method.
 JSP Execution: This phase (also known as the Request Processing phase) is executed each
time the JSP page is served by the web container. Request for the JSP page result in the
execution of the JSP page implementation class. This phase of the JSP life cycle represents
all interactions with requests until the JSP is destroyed. Whenever a browser requests a
JSP and the page has been loaded and initialized, the JSP engine invokes the _jspService()
method in the JSP. The _jspService() method takes an HttpServletRequest and an
HttpServletResponse as its parameters as follows:
void _jspService(HttpServletRequest request, HttpServletResponse response) {
// Service handling code...
}
The _jspService() method of a JSP is invoked once per a request and is responsible for generating
the response for that request and this method is also responsible for generating responses to all
seven of the HTTP methods ie. GET, POST, DELETE etc.
 JSP Cleanup: The destruction phase of the JSP life cycle begins when a JSP is being
removed from the web container. The jspDestroy() method is equivalent to the to the
destroy() method for servlets. Override jspDestroy when you need to perform any
cleanup, such as releasing database connections or closing open files. The jspDestroy()
method has the following form:
public void jspDestroy() {
// Your cleanup code goes here.
}
CHARACTERSTICS OF JSP:-
1) Interpreter: A JSP file will never get compiled by the user, rather it is compiled &
interpreted by the web server( javac is the compiler for servlet, jasper is the compiler of
jsp(i.e. servlet created from jsp), catalina is the interpreter for servlet & jsp)
Page | 23
2) Object base: JSP has some predefined object like request, response, exception,
application, session, out etc. by which we can perform various operation. JSP doesn’t
support Inheritance, Polymorphism. Hence JSP is Object Based.
a) Response: This Object behaves like HttpServletResponse interface to provide
response to the user.
b) Request: This Object behaves like HttpServletRequest interface by which we can get
data of the user.
c) Exception: It is an Object of java.Lang.Throwable call by which we can handle
exception in JSP.
d) Application: It is an Object which is similar to ServletContext interface by which we
can create application level variable.
e) Session: It is an Object of HttpSession class which is used to create user session of
individual user.
f) Out: It is an object of PrintWriter class by which we can invoke println().
3) Tag Based: JSP supports some predefined tags by which we can write Syntaxes. JSP also
supports user defined tags. Hence JSP able to achieve code reuse without the inheritance.
4) User Friendly: Since the HTML code & tag will remain outside of JSP tag. Hence it is easy
to design the HTML file by using IDE such as NetBeans, Eclipse and Dreamweaver etc.
SERVLET JSP
It is compiled by user & interpreted in server. It is interpreted by server
It is Object Oriented. It is object based.
HTML code appears within JAVA code. JAVA code will appear within HTML file.
It doesn’t support user defined tags. It is support user defined tags.
Creation process of JSP:
1. Create JSP file by providing .jsp extension.
2. Write java code within scriptlet tag as given bellow :-
<%
Page | 24
Java code goes here
%>
3. The JSP file should be stored directly in Context Folder i.e. root directory of the website.
4. Start the server & deploy/host the website. Access the JSP file by providing file name in
the URL along with URL of website.
Steps in the execution of a JSP application:
1. The client sends a request to the web server for a JSP file by giving the name of the JSP
file within the form tag of a HTML page or in url of href attribute of anchor tag.
2. This request is transferred to the JavaWebServer. At the server side JavaWebServer
receives the request and if it is a request for a jsp file server gives this request to the JSP
engine.
3. JSP engine is program which can understands the tags of the jsp and then it converts those
tags into a Servlet program and it is stored at the server side. This Servlet is loaded in the
memory and then it is executed and the result is given back to the JavaWebServer and
then it is transferred back to the result is given back to the JavaWebServer and then it is
transferred back to the client.
CONTENTS OF JSP:
1. DIRECTIVE TAGS: This tag is used to import any package or file to a JSP file. Generally this
tag must be given at the beginning of the JSP.
Syntax:
<%@ directive_name attribute=value %>
Example
<%@ page import=”java.util.*, java.sql.*” %>
Page: - Directive Name
Import: - Attribute Name
<%@ page include=”login.jsp” %>
Page | 25
Directive Description
<%@ page ... %> Defines page-dependent attributes, such as scripting language, error
page, and buffering requirements.
<%@ include ... %> Includes a file during the translation phase.
<%@ taglib ... %> Declares a tag library, containing custom actions, used in the page
2. DECLARATION SECTION/TAG: This section allows us to declare variables & objects which
will be used in a JSP. This tag must be written before we can provide any response given
to the client. This tag will never appear within any other tag.
Syntax:
<%! variables & object declaration %>
Example:
<%!
String s1,s2=null;
int a,b=0;
%>
3. CLIENT END SCRIPTING TAG: This section doesn’t belongs to JSP but JSP allows us to
provide client side validation by using javascript or vbscript.
Example:
<script language=”javascript”>
Scripting language/validation code goes here
</script>
4. HTML: Java allows us to provide HTML tag written JSP.
5. JSP TAG/ACTION TAG: Java has given some predefined tag in JSP to use bean class,
custom tag/user defined tag in JSP. As well as Java allows us to use user defined
tag/custom tag within a JSP file. This tag will never appear within any other tag.
Syntax Purpose
jsp:include Includes a file at the time the page is requested
jsp:include Includes a file at the time the page is requested
Page | 26
jsp:useBean Finds or instantiates a JavaBean
jsp:setProperty Sets the property of a JavaBean
jsp:getProperty Inserts the property of a JavaBean into the output
jsp:forward Forwards the requester to a new page
jsp:plugin Generates browser-specific code that makes an OBJECT or EMBED tag for the
Java plugin
jsp:element Defines XML elements dynamically.
6. SCRIPTLET TAG: This tag allows us to write Java syntax within a JSP file. This tag will never
appear within any other tag, but this tag may appear several times in a JSP file.
Syntax:
<%
Java codes
%>
7. EXPRESSION TAG: This tag is used to print the result of an expression or a variable directly
within JSP file. This tag may appear within any other tag. We can say this tag is a separate
mechanism to print value of variable or expression without println(). This tag will never
appear within scriptlet tag. This tag should not contain semicolon otherwise compilation
error will occur.
Example:
<%= x+2 %>
8. JSP COMMENTS: JSP comment marks text or statements that the JSP container should
ignore. A JSP comment is useful when you want to hide or "comment out" part of your
JSP page.
<%-- This is JSP comment --%> It is ignored by JSP engine.
<!-- This is html comment --> It is ignored by browser.
9. JSP IMPLICIT OBJECTS: JSP supports nine automatically defined variables, which are also
called implicit objects.
Objects Description
Page | 27
request This is the HttpServletRequest object associated with the request.
response This is the HttpServletResponse object associated with the response to the client.
out This is the PrintWriter object used to send output to the client.
session This is the HttpSession object associated with the request.
application This is the ServletContext object associated with application context.
config This is the ServletConfig object associated with the page.
pageContex
t
This encapsulates use of server-specific features like higher performance
JspWriters. It is an object of javax.servlet.jsp.PageContext
page This is simply a synonym for this, and is used to call the methods defined by the
translated servlet class. It’s an object of javax.servlet.jsp.HttpJspPage
exception The Exception object allows the exception data to be accessed by designated JSP.
Example(First.jsp) Second.jsp
<html><body bgcolor="pink">
<h1> Welcome to First jsp
<br>
<%
int x=12, y=23;
int z= x+y;
out.println("sum of "+x+"
and "+y+"="+z);
%>
</h1></body></html>
<html><body bgcolor="cyan">
<h1> Welcome to Second jsp <br><table
border=2>
<% for(int i=0; i<5; i++) {
out.println(“<tr>”);
for(int j=0; j<10; j++) {
out.println("<td> kalia</td>");
}
out.println(“</tr>”);
} %>
</h1></body></html>
Page | 28
Submitting Request JSP to itself : If in a jsp file if we have not given the action attribute
of the form tag then the data of the jsp page will be submitted to itself.
Itself.jsp :
<html><body bgcolor=”cyan”>
<%! String na, pw; %>
<%
try{ na=request.getParameter(“t1”);
pw=request.getParameter(“t2”);
}catch(Exception e){ }
if( na==null || na.equals(“”)){
%>
<form method=”get”><h1>
user name<input type=”text” name=”t1”><br>
password<input type=”password” name=”t2”><br>
<input type=”submit” value=”submit” /><input type=”reset” value=”reset”
/></h1></form>
<% } else {
out.printin(“Welcome”+na+”ur pass”+pw);
}
%>
</body></html>
Using DataBase in JSP with life cycle methods :
Store as Stud.html:
<html>
<head><title> Student details </title></head>
<body><form method="get" action="./getstud.jsp"><table border='1' align="center">
<tr>
<td>Student Roll Number</td>
Page | 29
<td><input type="text" name="rno" value=""></td>
</tr>
<tr>
<td><input type="submit" name="button"
value="Submit"></td>
</tr>
</table></form></body>
</html>
Store it as getstud.jsp :
<%--
JSP page design steps
1. In jspInit() method
create Connection, Statement, PreparedStatement objects
by reading driver information from web.xml file
Note: In jsp based project web.xml is mandatory only if
1. jsp file want to be configured as welcome file
2. to read jsp initialization parameters
2. In _jspService() method [Scriptlet tag] read student information from DB and display it
to end user with HTML table component
3. In jspDestroy() method release all JDBC objects.
--%>
<%@ page import = "java.sql.*"%>
<%! Connection con;
Statement stmt;
ResultSet rs;
%>
Page | 30
<%public void jspInit(){
try{
/* reading jsp intialialization values from web.xml file, means from ServletConfig object. retrieving
ServletConfig object */
ServletConfig config = getServletConfig();
ServletContext ctxt = config.getServletContext();
String driver = ctxt.getInitParameter("driver");
String url = ctxt.getInitParameter("url");
String usn = config.getInitParameter("usn");
String pwd = config.getInitParameter("pwd");
//preparing JDBC objects
Class.forName(driver);
con = DriverManager.getConnection(url, usn, pwd);
stmt = con.createStatement();
}catch(Exception e){ e.printStackTrace(); }
}
public void jspDestroy(){
//releasing JDBC objects
try{
if(stmt != null) {
stmt.close();
stmt = null;
}
if(con != null){
con.close();
con = null;
}
}catch(Exception e){
Page | 31
e.printStackTrace();
}
}
%>
<%
try{
//reading sno from html form
String rol = request.getParameter("rno").trim();
String query;
//checking user decision
if(rol == null || rol.equals("")){
//user want to list all students details
query = "SELECT * FROM stud";
}else {
//user want to retrieve only given student information
query = "SELECT * FROM stud WHERE roll =” + rol;
}
rs = stmt.executeQuery(query);
//preparing presentation logic
%>
<html> <head> <title> student details </title></head>
<body> <h1> Here the student roll number <%= rol %> details
<table border="1" align="center">
<tr> <th>Name</th> <th>Roll</th> <th>Sem</th> <th>Mark </th> </tr>
<% while (rs.next()) { %>
<tr> <td><%= rs.getString(1) %></td> <td><%= rs.getInt(2) %></td>
<td><%= rs.getString(3) %></td> <td><%= rs.getFloat(4) %></td> </tr>
<% } %>
</table></form></body>
Page | 32
</html>
<%
rs.close();
}catch(Exception e){ e.printStackTrace(); }
%>
web.xml :
<web-app....... >
<context-param>
<param-name>driver</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</context-param>
<context-param>
<param-name>url</param-name>
<param-value>jdbc:mysql://localhost/college</param-value>
</context-param>
<servlet>
<servlet-name>select</servlet-name>
<jsp-file>/getstud.jsp</jsp-file>
<init-param>
<param-name>usn</param-name>
<param-value>root</param-value>
</init-param>
<init-param>
<param-name>pwd</param-name>
<param-value></param-value>
</init-param>
</servlet>
Page | 33
<servlet-mapping>
<servlet-name>select</servlet-name>
<url-pattern>/getstud.jsp</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>Stud.html</welcome-file>
</welcome-file-list>
</web-app>
USER TRACKING : It can be achieved by followings: -
1. Url rewriting
2. Hidden field
3. Cookie
4. Session
1) URL rewriting (Store it as URLDemo.html )
<html><body bgcolor="yellow">
<form action="UDemo1.jsp" method ="get"><h1>
User Name <input type="text" name="t1" value="ur name"><br>
Password <input type="password" name="p1"><br>
<input type="submit" value="Submit"><input type="reset" value="Reset">
</h1></form></body></html>
UDemo1.jsp UDemo2.jsp :
<html><body bgcolor=cyan>
<%! String s1, s2; %>
<h1>Welcome to URL rewriting<br>
<% s1 = request.getParameter("t1");
s2 = request.getParameter("p1");
%>
<a href="UDemo2.jsp?a1=<%= s1 %> &a2=<%= s2
%>"> Click Me</a>
<html><body bgcolor=cyan>
<%! String s1, s2; %>
<%
s1 = request.getParameter("a1");
s2 = request.getParameter("a2");
%>
<h1>Welcome <%= s1 %> ur password is <%= s2
%>
Page | 34
</h1></body></html> </h1></body></html>
2) Hidden field: (Store it as HidDemo.html )
<html><body bgcolor="yellow">
<form action="Hid1.jsp" method ="post"><h1>
User Name <input type="text" name="t1" value="ur name"><br>
<input type="submit" value="Submit">
</h1></form></body></html>
Hid1.jsp Hid2.jsp
<html><body bgcolor=cyan>
<%! String s1; %>
<h1>Welcome to Hiiden Field<br>
<% s1 = request.getParameter("t1"); %>
<form action ="Hid2.jsp" method="post">
<input type="hidden" name="t1" value="<%= s1
%>">
Enter ur phone no<input type="text" name="t2">
<input type="submit" value="submit">
</form></h1></body></html>
<html><body bgcolor=cyan>
<%! String s1, s2; %>
<% s1 = request.getParameter("t1");
s2 = request.getParameter("t2");
%>
<h1>Welcome <%= s1 %> ur phno is <%= s2 %>
</h1></body></html>
3) Cookie : (Store it as CookDemo.html )
<html><body bgcolor="magenta">
<form action="Cookie1.jsp" method ="get"><h1>
User Name <input type="text" name="t1" ><br>
password <input type="password" name="t2" ><br>
<input type="submit" value="Submit">
</form></body></html>
Page | 35
Cookie1.jsp Cookie2.jsp
<html><body bgcolor="cyan">
<% String s1= request.getParameter("t1");
String s2= request.getParameter("t2");
Cookie c1=new Cookie("name", s1);
Cookie c2=new Cookie("pwd", s2);
response.addCookie(c1);
response.addCookie(c2);
%>
<h1>Welcome to Cookie <a href="Cookie2.jsp">
Testing ur Cookie</a></h1></body></html>
<html><body bgcolor="pink">Cookie example
<br>
<% Cookie ck[]= request.getCookies();
for(int i=0; i< ck.length;i++) {
%>
Variable name : <%= ck[i].getName()
%> value is : <%= ck[i].getValue() %><br>
<% } %>
</h1></body></html>
4) Session: (Store it as SessDemo.html)
<html><body bgcolor="yellow" >
<form action="Sess1.jsp"><h1>
Enter ur name &nbsp;&nbsp;<input type="text" name="t1"> <br>
Enter password &nbsp;&nbsp;<input type="password" name="t2"><br>
<input type="submit" value="Submit"></h1></form></body></html>
Sess1.jsp Sess2.jsp
<html><body bgcolor=red>
<h1>Welcome to session<br>
<%! String s1, s2; %>
<% s1=request.getParameter("t1");
s2=request.getParameter("t2");
session.setAttribute("uname",s1);
session.setAttribute("pwd", s2);
%>
<a href="Sess2.jsp">Click</a>
</h1></body></html>
<html><body bgcolor=pink>
<h1>The value of ur session is :2nd JSP<br>
<%! String p1, p2; %>
<%
p1=(String) session.getAttribute("uname");
p2=(String) session.getAttribute("pwd");
%>
user name : <%= p1 %> <br>
password : <%= p2 %>
</h1></body></html
Page | 36
INCLUDING AND FORWARDING THE REQUEST:
When HTML will send the reqeust to first JSP, then the first JSP will process the request and
provide the response back to the browser. But the users request will not be available to 2nd /
3rd JSP. The request forwarding mechanism allows us to propagate the same request of the user
to 1st, 2nd, 3rd JSP and so on. The last JSP will provide the response to the user, other JSP will
remain invisible to the user.
The request forwarding mechanism in servlet provide extra information to the other
servlet. This mechanism is also available in accessing a JSP from servlet in JSP chapter because
it will forward the same request and response of the user or to the other servlet. But in case of
JSP we can also add extra information from one JSP to other alongwith the users request. The
request forwarding mechanism in JSP can be achieved by <jsp:forward> as givewn below
<jsp:forward Page = “For2. JSP” >
<jsp:param name= “name” value = “<%= s2 %>”/>
</jsp:forward>
The <jsp: forward> is a predefined JSP tag and it will hold the address of next JSP file in
page attribute to which the users request will be forwarded. Let us say, we have written the
above code in For1. jsp, the request available to For1. jsp will be forwarded to For2. Jsp, as well
as For1. jsp may process the users reqeust on the data base or can implement any logic on the
users request, then For1. jsp may forward the users request to For2. jsp. The For1. jsp is also able
to provide extra information or value to For2.jsp by using jsp: param subtag of < jsp:forward>.
The for2.jsp will get the users request by using getParameter() as well as the value given in
<param > by providing the name given in <param> in getParameter()
If we do not provide the jsp:param subtag then we can write the<jsp:forward> in one line
as <jsp:forward page = “for2.jsp” />
Similarly, the <jsp: include >allows us to include content of another jsp./HTML file into
current jsp file.
<jsp:include page = “login.html”/>
Page | 37
STATIC INCLUDE : In this mechanism the content of one jsp file is included within another jsp.file.
It is similar to <jsp:include> in case of static include the content of one jsp file will be included
within another jsp before the jsp is converted into servlet. But in case <jsp: include> the result /
response/ output of one jsp file is included within another jsp file.
The static include helps us to avoid the duplicacy of a code to use same code in all pages.
e.g. We can create dbcon.jsp in which we will write the database connection statement ,so that
it will be included in any jsp page of the website.but in case of <jsp:include> we can use same
design or output of one webpage in one jsp file.
EXCEPTION HANDLING IN JSP :
When an exception occurs in a jsp, then the info of the exception is directly displayd on the
browser. This mechanism redirects the exception/error of a jsp file to an error page (error page
is also another jsp). When exception occurs in a jsp then control will be transferred to error page
for handling the exception as well asto avoid the exception stack/info on the browser.
The jsp file in which the exception may occur must provide the jsp file name which will
handel the exception in errorPage attribute of page directive.
Ex : <%@ page errorPage=”B.jsp” /> , say we have written this statement in A.jsp & when
exception will occur in A.jsp then control will be transferred to B.jsp file.
To implements this mechanism we can creae one jsp file(say B.jsp) to handel the
exception(papularly called error page) for entire website. This page must provide “true” to
isErrorPage attribute of page directive, this page must use predefined exception object to deal
with exception,
Ex : <%@ page isErrorPage=”true” /> , say we have written this statement in B.jsp, hence
this file handel the exception.
JAVA BEAN : Java Bean is a reusuable component (bean is a simple java class) Java bean provides
a mechanism to create development component. The components are part of the system /
software which is used to perform a well defined task. A component may be a visible component
/ it may be an invisible component.
Page | 38
A visible component works with the user interface of the s/w whereas an invisible
component will work behind the user interface of the s/w. A normal java class with a set of
convention for its properties and behavior (data member and member function) is known as java
bean. The properties of the bean class must be accessed / modified by the methods of Bean class.
Contents of Java Bean
a. Properties (data member)
b. Method
c. Event
a) Properties: The variables declared within java class is called properties of the Bean class
.The properties represents state of the java bean. A Bean class has 5 types of properties
as given below:
i. Simple Property
ii. Indexed Property
iii. Boolean Property
iv. Bound Property
v. Constraint Property
i. Simple Property : If the data member of Bean class doesnt belong to boolean
datatype of an array,then it is called Simple Property.
a. E.g int x; String name;
ii. Indexed Property : If the data member of Bean class is an array which can be modified
by using index/counter,then it is called Indexed property .
i. E.g int a[];
iii. Boolean Property : If the data member of Bean class belongs to boolean datatype
then it is called boolen property which may hold true/false value.
i. E.g boolen z;
iv. Bound Property : If the data member of Bean classs will change by changing the
value of another Property then this type of variable is called Bound Property.
Whenever the value of Bound Property will change then an object of
Page | 39
java.beans.PropertyChangeEvent class is generated. To handle this event
PropertyChangeListener interface is used.
i. E.g if salary &job are 2 datamemberof Bean class ,when the value of
job properties change, then we will change value of salary Property.
v. Constraint Property : If depending upon the value of a data member of the Bean class
a condition must be satisfied, then it will be called Constraint Property. If the condition
does not satisfy then the Bean class will terminate the execution and the property will
not change its value ,such type of property accquires vetopower. Whenever the
value of Constraint Property changes then an object of PropertyChangeEvent class is
generated and to handle it VetoableChangeListener interface is used.
b) Method: The method of Bean class are used to provide and accesss the values of the
properties i.e data members.Basically methods are of two types known as :
i. Property Setter/Modifier method
ii. Property Getter/Accesser method
i. Property accesser method: This methods are used to fetch the value of Property.
This method names must start with a prefix called get followed by the property
name .The return type of these method must be remain same to that of the data
type of the Property , and these method should not accept any parameter.
E.g Let us say the property is String name, then the property setter method is :
public String getName()
ii. Property modifier method : This methods are used to modify/set the value of a
Property .The name of the method must start with a prefix called set followed by
the Property name. The return type of this function must always be void. This
function must accept a parameter whose datatype must remain the same to that
of the datatype of the Property.
Eg: If name is the Property, then the method will be public void setName(String b)
User defined Tag/Custom Tag
This is a process of creating user defined tag. This tag used to perform any kind of task. It provides
the following advantages-
Page | 40
1) Code reusability:- After the creation of tag it can be used by any no. of JSP to perform the
same tag. Hence the custom tag class or the code behind the tag becomes reusable.
2) Code abstraction:- User of the tag shouldn’t know the implementation logic of the
custom tag which allow a programmer to remove the task from the JSP.
3) Avoiding duplication:- A custom tag may perform a common task required for more than
one jsp. Hence the required code to perform the common task can be kept within the tag
class.
Requirement for creating Custom tag:-
a) Tag class :- This class contains logic for the tag.
b) TLD (Tag library discripter ):- As the info^ of the servlet is given in “web.xml” file, similarly
the info of custom tag is given in .TLD file. It’s a xml type file.
As in jsp we use <jsp:useBean> tag to get information about the Bean class, similarly in the jsp
file use taglib attribute of page directive ( <%@ taglib...>) . to acess the tag class as well as o
create the tag name (tag name is the similar to object of Bean class in jsp)
c) Creation process of tag class:-
(i) Create a class by inheriting from TagSupport class available in javax.servlet.jsp.tagext
package and the user defined class must remain as public.
(ii) Provide variables within this class which will become attributes of the custom tag.
(iii) The setter ( ) is used to provide the value of attributes(variables).
(iv) Override the method of TagSupport class to represent the logic for <start> and <end>
For starting tag the method is public int doStartTag ( ), for ending tag the method is public int
doEndTag().
This method return an integer value by the constant present in TagSupport of the class.
These constants are:-
1) TagSupport.EVAL_ BODY_ INCLUDE : This constant can be applied only as the return value
of doStartTag ( ). This makes the body of the tag to execute (the content available within
starting & ending tag in jsp file will execute)
2) TagSupport.SKIP_BODY : This constant can be applied only to doStartTag ( ). It doesn’t
allow the body of tag to execute.
Page | 41
3) TagSupport.EVAL_PAGE : This constant can only be used for doEndTag ( ). This makes the
remaining part of the page to execute.
4) TagSupport.SKPI_PAGE : This constant can be applied only for doEndTag ( ). This doesn’t
allow remaining part of the page to execute.
d) Create an object of JspWriter class by using getOut ( ) of pageContext object. This is
required for printing the o/p lines of the tag from doStartTag ( ) or doEndTag ( ).
e) The user defined tag class must be stored within a package, and the package must be
stored under classes’ folder of WEB-INF folder of root directory.
f) Compile the user defined Tag class by providing servlet-api.jar & jsp-api.jar in class path.
Creation process of TLD:
The extension of this file must be .TLD within any name. Copy any .TLD file available in Tomcat
home directory and paste it under WEB-INF folder. Open this file in edit mode and remove all the
tag within </short_name> and </taglib>. Use the following tags before </taglib> but after </short
name> as given below:-
…………………… </short_name>
<tag> - it is used to provide info of user defined tag class.
<name> - it is name by which jsp will access the user defined tag class. (It is similar to the url
pattern of servlet.) </name>
<tag-class> Provide the full qualified name of the custom tag class </tag-class>
<attribute> - it is used to provide info about the attribute of tag.
<name> col </name> - name of attribute of tag, and it must be same name as that of the data
member of user defined tag class.
<required> true </required> - if value of this is true then this attribute of tag is a mandatory
attribute, if false then this attribute is optional.
<rtexprvalue> true <rtexprvalue> - if it is true then the attribute will accept value dynamically at
run-time, such as by expression tag. If it is false then the attribute will not accept run-time value.
</attribute>
<attribute> - info of 2nd attribute
<name> ……… </name>
Page | 42
<required> ……………..</reqired>
<rtexprvalue>………….</rtexprvalue>
</attribute>
</tag>
Using the user defined Tag / custom tag in Jsp:-
As Jsp uses <jsp:useBean> to use a bean class similarly to use the <custom> the Jsp must provide
taglib directive tag as given below
<%@ taglib uri =”/WEB_INF/Test.tld” prefix = “p1” %>
The uri attribute of taglib directive gets the info of custom tag from .tld file. Hence it must hold
the name of the .tld file along with the WEB-XML folder. Because Jsp file is stored in context
folder.
prefix attribute holds an user defined name, which will behave like an object of .tld file by which
we can access different tag names available in .tld file.
PageContext:
PageContext represents a class that provides methods that are implementation-dependent. The
PageContext class itself is abstract, so in the _ jspService method of a JSP servlet class, a
PageContext object is obtained by calling the getPageContext method of the JspFactory class.
The PageContext class provides methods that are used to create other objects. For example, its
getOut method returns a JspWriter object that is used to send strings to the web browser. Other
methods that return servlet-related objects include the following:
• getRequest, returns a ServletRequest object
• getResponse, returns a ServletResponse object
• getServletConfig, returns a ServletConfig object
• getServletContext, returns a ServletContext object
• getSession, returns an HttpSession object
The JspWriter Class :
Page | 43
The JspWriter class is derived from the java.io.Writer class and represents a Writer that you can
use to write to the client browser. Of its many methods, the most important are the print and
println methods. Both provide enough overloads that ensure you can write any type of data.
Additional methods allow you to manipulate the buffer. For instance, the clear method
clears the buffer. It throws an exception if some of the buffer's content has already been flushed.
Similar to clear is the clearBuffer method, which clears the buffer but never throws any exception
if any of the buffer's contents have been flushed.
Accessing a Jsp from the Servlet.
ServRec.html :
<html> < body bgcolor = “cyan”> <h1>
<form action = “../servJsp” method = get>
Name : <input type = “text” name = “t1”> <br>
Password : <input type = “password” name = “t2”><br>
<input type = “submit” value =”submit”>
</hi> </form> </body> </html>
The above html file is accessing the Serv2jsp.java (servlet) whose url pattern is servJsp in web.xml.
but this ServRec.html file is not stored in context folder (i.e./under google) rather the
ServRec.html is stored under c:....webappgoogleserv folder, hence we must provide the root
folder name in order to access the srevlet. Since the serv folder is within google folder hence in
action we have given ../ServJsp, here .. refers to parent folder i.e. to the google.
Serv2Jsp.java
Import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Serv2Jsp extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException {
try {
Page | 44
request.setAttribute ("s1", "Serv2Jsp"); //Set the attribute & value to forward to
hello.jsp
ServletConfig scf = getServletConfig();
ServletContext sc =scf.getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher("/serv/hello.jsp");
rd.forward(request, response);
} catch (Exception ex) {
ex.printStackTrace ();
}
}};
Hello.jsp :
<html> <body bgcolor=”pink”> <h1>
1 have been invoked by
<% out.print(request.getAttribute(“s1”).toString() ); %>
Servlet .<br> your name : <%= request.getParameter(“t1”) %><br>
your password : <%= request.getParameter(“t2”) %>
<h1> </html>
getServletConfig( ) :- This method GenericServlet class returns a reference of ServletConfig
interface. This interface is used by a servlet container to pass info to a servlet during initialization.
Since this interface we have used in above servlet, hence the value will be the passed to the
Hello.jsp by the web server. Because this servlet program is forwarding the users request to the
Hello.Jsp. therefore the value given by sevlet container by using ServletConfig interface, apart
from the users request exra information can be passed from srvlet to Hello.Jsp by setAttribute ().
setAttribute (String variable name,String variable value) : This method of HttpServletRequest
interface is used to provide extra value from the servlet to other servlet/Jsp. This method will
accept the user defined variable name along with a value as pecified by 1st & 2nd parameter
respectively, so that the other servlet/jsp will access the value by providing the variable name in
getAttribute() of HttpServletRequest interface in servlet/by request object in Jsp file.
Page | 45
Attributes of <jsp:plugin>
 type = “bean/applet” -- The type of object the plug-in will execute. You must specify
either bean/applet, as this attribute has no default value.
 code = “class file name” -- The name of java class file the plug-in will execute. You must
include the .class extension in the name. The file you specify should be in the directory
named in the codebase attribute.
 codebase = “class file directory name” -- The directory (or path to the directory) that
contains the java class file the plug-in will execute. If you don’t supply a value, the path of
Jsp file that calls <Jsp.plugin> is used.
 name = “instance Name” -- A name for the instance of the Bean or applet. Which makes
it possible for applet or Beans called by the same Jsp file to communicate with each other.
<jsp:params>
<jsp:params name =”parameter Name” value = “{parameter value/<% =expression%>}
”/>
</jsp:params>
The parameters and value that you want to pass to the applet or bean. To specify more
than one <jsp:param> we have to specify one <jsp:param> element within the other
<jsp:params> elements. The name attribute specifies the parameter name and takes a case-
sensitive literal string. The value attribute specifes the parameter value and takes either a case-
sensitive literal string or an expression that is evaluated at runtime.
<jsp:fallback> text msg for user </jsp:fallback> -- A text msg to display for the user if the plug-
in can’t be started. If the plug-in starts but the applet or bean doesn’t, the plug-in usually displays
a popup window explaining the error.
Page | 46
THE CODINGS:
1. index.jsp
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CseDept</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="css/custom.css" rel='stylesheet' type='text/css' />
<script type='text/javascript' src="js/jquery-1.11.3.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/jquery.js"></script
</head>
<body>
<jsp:include page="head.jsp" />
<div class="container">
<div id="metro" class="row" style="padding:10px 10px;margin-top:50px;">
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px;">
<div class="brick1">
<a href="#" class="nav-item" data-toggle="modal" data-target="#myModal">
<div class="nav-hover"></div>
<img src="img/attendence.png" class="img-responsive" />
<span>Attendence</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px; background:#09C;">
<div class="brick1 odd">
<a href="notices.jsp" class="nav-item">
<div class="nav-hover"></div>
<img src="img/notice.png" class="img-responsive" />
Page | 47
<span>Notices</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px;">
<div class="brick1 odd">
<a href="result.jsp" class="nav-item">
<div class="nav-hover"></div>
<img src="img/results.png" class="img-responsive" />
<span>Results</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px; background:#09C;">
<div class="brick1">
<a href="signup.jsp" class="nav-item">
<div class="nav-hover"></div>
<img src="img/reg.png" class="img-responsive" />
<span>Register</span>
</a>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix">
</div>
<div id="bg" style="margin-top:50px;">
<div class="container">
<div class="jumbotron" id="article">
<h3>Welcome to Computer Science Official Website!</h3>
</div>
Page | 48
</div>
</div>
<jsp:include page="foot.jsp" />
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-
labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times;
</button>
<h4 class="modal-title" id="myModalLabel">Enter Your Registration</h4> </div>
<div class="modal-body bg bg-warning">
<form class="form-horizontal"
action="attendance.jsp?reg=<%=request.getParameter("reg1")%>" method="get" style="text-
align:center;">
<div class="form-group">
<div class="col-lg-4 col-lg-offset-4">
<input type="text" maxlength="10" placeholder="Registration"
name="reg1" id="reg1" class="form-control" required>
</div>
</div>
<div class="form-group">
<input type="submit" name="submit" value="Submit" class="btn btn-primary">
<button type="button" class="btn btn-default" data-dismiss="modal">Close
</button>
</div>
</form>
</div>
<div class="modal-footer"> </div> </div><!-- /.modal-content --> </div><!-- /.modal -->
</body>
</html>
Page | 49
2. Adminhome.jsp
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CseDept</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="css/custom.css" rel='stylesheet' type='text/css' />
<script type='text/javascript' src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/jquery.js"></script>
</head>
<body>
<jsp:include page="head.jsp" />
<div class="container-fluid" style="background:#5ce3a2;color:white;text-align:center;font-
size:20px;">
Welcome Prof. <%=(String)session.getAttribute("logname")%> to admin page.
</div>
<div class="container">
<div id="metro" class="row" style="padding:10px 10px;margin-top:80px;">
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px;">
<div class="brick1">
<a href="signup.jsp" class="nav-item" target="_new">
<div class="nav-hover"></div>
<img src="img/add.png" class="img-responsive" />
<span>Add Student</span>
</a>
</div>
</div>
Page | 50
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px; background:#09C;">
<div class="brick1 odd">
<a href="notice_gen.jsp" class="nav-item" target="_new">
<div class="nav-hover"></div>
<img src="img/notice.png" class="img-responsive" />
<span>Create Notice</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px;">
<div class="brick1 odd">
<a href="mark_en.jsp" class="nav-item" target="_new">
<div class="nav-hover"></div>
<img src="img/results.png" class="img-responsive" />
<span>Marks Entry</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px; background:#09C;">
<div class="brick1">
<a href="reg.jsp" class="nav-item" target="_new">
<div class="nav-hover"></div>
<img src="img/reg.png" class="img-responsive" />
<span>Register</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px;background:#09C;">
<div class="brick1">
Page | 51
<a href="atten_select.jsp" class="nav-item" target="_new">
<div class="nav-hover"></div>
<img src="img/attendence.png" class="img-responsive" />
<span>Attendence</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px; ">
<div class="brick1 odd">
<a href="fine_per.jsp" class="nav-item" target="_new">
<div class="nav-hover"></div>
<img src="img/fine.png" class="img-responsive" />
<span>Fine Manager</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px;background:#09C;">
<div class="brick1 odd">
<a href="facsub.jsp" class="nav-item" target="_new">
<div class="nav-hover"></div>
<img src="img/results.png" class="img-responsive" />
<span>Faculty Manager</span>
</a>
</div>
</div>
<div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px; ">
<div class="brick1">
<a href="reg.jsp" class="nav-item" target="_new">
<div class="nav-hover"></div>
Page | 52
<img src="img/sms.png" class="img-responsive" />
<span>Send Report</span>
</a>
</div>
</div>
</div>
</div>
<footer style="margin-top:73px;">
<jsp:include page="foot.jsp" />
</footer>
</body>
</html>
3. Fachome.jsp
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CseDept</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-
scale=1">
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="css/custom.css" rel='stylesheet' type='text/css' />
<link href="css/sidebar.css" rel='stylesheet' type='text/css' />
<script type='text/javascript' src="js/jquery-1.11.3.min.js"></script>
<script src="js/bootstrap.js"></script>
<style type="text/css">
#hm a:link{border-left:5px solid white;}
</style>
</head>
<body>
Page | 53
<jsp:include page="head.jsp" />
<jsp:include page="below_head.jsp" />
<div class="container-fluid">
<div id="wrapper">
<jsp:include page="facmenu.jsp" />
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<img src="img/login-bg.png" height="375px">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<jsp:include page="foot.jsp" />
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
</body>
</html>
Page | 54
THE DATABASE TABLES
(The admin table)
(The attendance table)
Page | 55
(The department table)
(The faculty table)
Page | 56
(The faculty subject table)
(The login table)
Page | 57
(The student table)
(The subject table)
Page | 58
THE SNAPSHOTS OF OUR PORTAL
(Home page)
(Admin home page)
Page | 59
(Faculty home page)
(The fine manager page)
Page | 60
(Login page)
(Notice generation page)
Page | 61
(Faculty profile page)
(ATTENDANCE ENTRY)
Page | 62
(ATTENDANCE VIEW)
Page | 63
CONCLUSION
The Attendance Management System is developed using Adv. Java and MySQL fully meets the
objectives of the system which it has been developed. This system helps to reduce the time of
faculties and cost of the paper and ink used in the previous attendance system. The system has
reached a steady state where all bugs have been eliminated. The system is operated at a high
level of efficiency and all the teachers and user associated with the system understands its
advantage. The system solves the problem. It was intended to solve as requirement specification.
Page | 64
BIBLIOGRAPHY
1. www.w3schools.com
2. www.tutorialspoint.com
3. www.google.com
4. www.stackoverflow.com
5. www.slideshare.com

Weitere ähnliche Inhalte

Was ist angesagt?

Attendance management system project report.
Attendance management system project report.Attendance management system project report.
Attendance management system project report.Manoj Kumar
 
School management System
School management SystemSchool management System
School management SystemHATIM Bhagat
 
College mgmnt system
College mgmnt systemCollege mgmnt system
College mgmnt systemSayali Birari
 
Project report college information management system on Advanced Java
Project report college information management system on Advanced JavaProject report college information management system on Advanced Java
Project report college information management system on Advanced JavaRishabh Kumar ☁️
 
Student result mamagement
Student result mamagementStudent result mamagement
Student result mamagementMickey
 
Leave management System
Leave management SystemLeave management System
Leave management Systempratikmahorey
 
School Management System
School Management SystemSchool Management System
School Management SystemZain Basit
 
College transport management system
College transport management systemCollege transport management system
College transport management systemPrateek Singh
 
Ppt of online Attendance system
Ppt of online Attendance system Ppt of online Attendance system
Ppt of online Attendance system Shyam Sundar Pandey
 
Student Attendance
Student AttendanceStudent Attendance
Student AttendanceBUBT
 
Hostel Management System(HMS)
Hostel Management  System(HMS)Hostel Management  System(HMS)
Hostel Management System(HMS)Omkar Walavalkar
 
Online doctor appointment and emr system
Online doctor appointment and emr systemOnline doctor appointment and emr system
Online doctor appointment and emr systemAnjelika Parasar
 
Online examination system
Online examination systemOnline examination system
Online examination systemRahul Khanwani
 
Development of-pharmacy-management-system
Development of-pharmacy-management-systemDevelopment of-pharmacy-management-system
Development of-pharmacy-management-systemJoy Sarker
 
Online course registration system development software engineering project pr...
Online course registration system development software engineering project pr...Online course registration system development software engineering project pr...
Online course registration system development software engineering project pr...MD.HABIBUR Rahman
 

Was ist angesagt? (20)

Attendance Management System
Attendance Management SystemAttendance Management System
Attendance Management System
 
Attendance management system project report.
Attendance management system project report.Attendance management system project report.
Attendance management system project report.
 
ONLINE STUDENT FEEDBACK SYSTEM
ONLINE STUDENT FEEDBACK SYSTEMONLINE STUDENT FEEDBACK SYSTEM
ONLINE STUDENT FEEDBACK SYSTEM
 
School management System
School management SystemSchool management System
School management System
 
College mgmnt system
College mgmnt systemCollege mgmnt system
College mgmnt system
 
Attendance management system
Attendance management systemAttendance management system
Attendance management system
 
Project report college information management system on Advanced Java
Project report college information management system on Advanced JavaProject report college information management system on Advanced Java
Project report college information management system on Advanced Java
 
Student result mamagement
Student result mamagementStudent result mamagement
Student result mamagement
 
Hostel management
Hostel managementHostel management
Hostel management
 
Leave management System
Leave management SystemLeave management System
Leave management System
 
School Management System
School Management SystemSchool Management System
School Management System
 
College transport management system
College transport management systemCollege transport management system
College transport management system
 
Ppt of online Attendance system
Ppt of online Attendance system Ppt of online Attendance system
Ppt of online Attendance system
 
Student Attendance
Student AttendanceStudent Attendance
Student Attendance
 
Hostel Management System(HMS)
Hostel Management  System(HMS)Hostel Management  System(HMS)
Hostel Management System(HMS)
 
College admission system
College admission system College admission system
College admission system
 
Online doctor appointment and emr system
Online doctor appointment and emr systemOnline doctor appointment and emr system
Online doctor appointment and emr system
 
Online examination system
Online examination systemOnline examination system
Online examination system
 
Development of-pharmacy-management-system
Development of-pharmacy-management-systemDevelopment of-pharmacy-management-system
Development of-pharmacy-management-system
 
Online course registration system development software engineering project pr...
Online course registration system development software engineering project pr...Online course registration system development software engineering project pr...
Online course registration system development software engineering project pr...
 

Ähnlich wie Online Attendance System

Survey on Web Based Academic Smart System using Asp.Net
Survey on Web Based Academic Smart System using Asp.NetSurvey on Web Based Academic Smart System using Asp.Net
Survey on Web Based Academic Smart System using Asp.NetIRJET Journal
 
LIBARARY MANAGEMENT SYSTEM..docx
LIBARARY MANAGEMENT SYSTEM..docxLIBARARY MANAGEMENT SYSTEM..docx
LIBARARY MANAGEMENT SYSTEM..docxAmitmAHI4
 
IRJET- An Android Platform for Acquainting Differently Abled Students with Wr...
IRJET- An Android Platform for Acquainting Differently Abled Students with Wr...IRJET- An Android Platform for Acquainting Differently Abled Students with Wr...
IRJET- An Android Platform for Acquainting Differently Abled Students with Wr...IRJET Journal
 
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.docSCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.docbosed0737
 
quiz game project report.pdf
quiz game project report.pdfquiz game project report.pdf
quiz game project report.pdfzccindia
 
Online Quiz System Project Report
Online Quiz System Project Report Online Quiz System Project Report
Online Quiz System Project Report Kishan Maurya
 
Online examination management system..pdf
Online examination management system..pdfOnline examination management system..pdf
Online examination management system..pdfKamal Acharya
 
Library Management System Project in PHP with BlackBook & Source Code
Library Management System Project in PHP with BlackBook & Source CodeLibrary Management System Project in PHP with BlackBook & Source Code
Library Management System Project in PHP with BlackBook & Source CodeRadikhaSharma
 
Hostel Management system Report
Hostel Management system ReportHostel Management system Report
Hostel Management system ReportPrasoon Rawat
 
Electronic Student course registration System
Electronic Student course registration SystemElectronic Student course registration System
Electronic Student course registration SystemOkpehHarrison
 
14.project online eamination system
14.project online eamination system14.project online eamination system
14.project online eamination systemVivek Mehta
 
student-data-management-1-2.doc
student-data-management-1-2.docstudent-data-management-1-2.doc
student-data-management-1-2.docJagaBehera1
 
Hostel Mess Attendance Management System using Wifi
Hostel Mess Attendance Management System using WifiHostel Mess Attendance Management System using Wifi
Hostel Mess Attendance Management System using WifiIRJET Journal
 

Ähnlich wie Online Attendance System (20)

Survey on Web Based Academic Smart System using Asp.Net
Survey on Web Based Academic Smart System using Asp.NetSurvey on Web Based Academic Smart System using Asp.Net
Survey on Web Based Academic Smart System using Asp.Net
 
Fyp report
Fyp reportFyp report
Fyp report
 
LIBARARY MANAGEMENT SYSTEM..docx
LIBARARY MANAGEMENT SYSTEM..docxLIBARARY MANAGEMENT SYSTEM..docx
LIBARARY MANAGEMENT SYSTEM..docx
 
IRJET- An Android Platform for Acquainting Differently Abled Students with Wr...
IRJET- An Android Platform for Acquainting Differently Abled Students with Wr...IRJET- An Android Platform for Acquainting Differently Abled Students with Wr...
IRJET- An Android Platform for Acquainting Differently Abled Students with Wr...
 
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.docSCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
 
quiz game project report.pdf
quiz game project report.pdfquiz game project report.pdf
quiz game project report.pdf
 
Online help desk
Online help deskOnline help desk
Online help desk
 
Online Quiz System Project Report
Online Quiz System Project Report Online Quiz System Project Report
Online Quiz System Project Report
 
Project presentation.ppt
Project presentation.pptProject presentation.ppt
Project presentation.ppt
 
Bright
BrightBright
Bright
 
Bright copy
Bright   copyBright   copy
Bright copy
 
Introduction to Networking
Introduction to NetworkingIntroduction to Networking
Introduction to Networking
 
Online examination management system..pdf
Online examination management system..pdfOnline examination management system..pdf
Online examination management system..pdf
 
Web portal
Web portalWeb portal
Web portal
 
Library Management System Project in PHP with BlackBook & Source Code
Library Management System Project in PHP with BlackBook & Source CodeLibrary Management System Project in PHP with BlackBook & Source Code
Library Management System Project in PHP with BlackBook & Source Code
 
Hostel Management system Report
Hostel Management system ReportHostel Management system Report
Hostel Management system Report
 
Electronic Student course registration System
Electronic Student course registration SystemElectronic Student course registration System
Electronic Student course registration System
 
14.project online eamination system
14.project online eamination system14.project online eamination system
14.project online eamination system
 
student-data-management-1-2.doc
student-data-management-1-2.docstudent-data-management-1-2.doc
student-data-management-1-2.doc
 
Hostel Mess Attendance Management System using Wifi
Hostel Mess Attendance Management System using WifiHostel Mess Attendance Management System using Wifi
Hostel Mess Attendance Management System using Wifi
 

Kürzlich hochgeladen

Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 

Kürzlich hochgeladen (20)

Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 

Online Attendance System

  • 1. Page | 1 ONLINE ATTENDANCE SYSTEM A PROJECT REPORT Submitted by AKASH KU. SINHA-1201297077 RAKESH KU. SAHOO-1201297074 ARPITA PRIYADARSHINEE-1201297073 SAIPRIYA MOHAPATRA-1201297076 Department of Computer Science & Engineering Under the guidance of PROF. SAKTI CHARAN PANDA HOD, Asst. Professor, Department of CSE Nalanda Institute of Technology In partial fulfillment for the award of the degree Of BACHELOR OF TECHNOLOGY In COMPUTER SCIENCE & ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING NALANDA INSTITUTE OF TECHNOLOGY, BHUBANESWAR BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ROURKELA
  • 2. Page | 2 APRIL 2016 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING NALANDA INSTITUTE OF TECHNOLOGY BHUBANESWAR CERTIFICATE This is to certified that the seminar report “ONLINE ATTENDANCE SYSTEM” being submitted by AKASH KU. SINHA, ARPITA PRIYADARSHINEE, RAKESH KU. SAHOO, SAIPRIYA MOHAPATRA bearing registration number: 1201297077, 73, 74, 76 respectively in partial fulfillment of requirement for the award of degree of Bachelor in Technology in CSE is a bonafide work carried out under my/our supervision. Prof. Sakti Charan Panda Head Of the Department, CSE Nalanda Institute of Technology Chandaka, Bhubaneswar Prof. Sakti Charan Panda HOD, Asst. Professor Department of CSE
  • 3. Page | 3 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING NALANDA INSTITUTE OF TECHNOLOGY BHUBANESWAR CERTIFICATE This is to certify that AKASH KU. SINHA, ARPITA PRIYADARSHINEE, RAKESH KU. SAHOO, SAIPRIYA MOHAPATRA bearing registration number 1201297077, 73, 74, 76 has successfully presented their project on “ONLINE ATTENDANCE SYSTEM” in the presence of the undersigned dignitaries. Their skill set, knowledge on software and sincere effort has contributed towards successful completion of the project. Prof. Sakti Charan Panda HOD, CSE Nalanda Institute of Technology Chandaka, Bhubaneswar EVALUATORS Nalanda Institute of Technology Bhubaneswar
  • 4. Page | 4 ACKNOWLEDGEMENT We take this opportunity with much pleasure to thank all the people who have helped me through the course of my journey towards producing this project. I sincerely thank my thesis guide, Prof. SAKTI CHARAN PANDA for his guidance, help and motivation. Apart from the subject of my research, I learnt a lot from him, which we are sure will be useful in different stages of our life. I would like to express my gratitude to our HOD Prof. Sakti Charan Panda for his review and many helpful comments. We are especially grateful to our colleagues for their assistance, criticisms and useful insights. I am thankful to all the other students of Nalanda Institute of Technology, Bhubaneswar with whom I share tons of fun memories. I would like to acknowledge the support and encouragement of my friends. My sincere gratitude also goes to all those who instructed and taught me through the years. Finally, this thesis would not have been possible without the confidence, endurance and support of my family. My family has always been a source of inspiration and encouragement. I wish to thank my parents, whose love, teachings and support have brought me this far. Akash ku. Sinha-1201297077 Rakesh ku. Sahoo-1201297074 Arpita Priyadarshinee-1201297073 Saipriya Mohapatra-1201297076 Department of CSE
  • 5. Page | 5 CONTENTS SL. NO. TOPIC PAGE NO. 1. INTRODUCTION 6 2. FEASIBILITY STUDY 6 3. HARDWARE AND SOFTWARE REQUIREMENTS 7 4. MYSQL DATABASE 8 5. DISADVANTAGE OF CURRENT WORKING SYSTEM 9 6. CHARACTERISTICS OF PRTOPOSED SYSTEM 10 7. ANALYSYS 11 8. DATA FLOW DIAGRAMS 12 9. E-R DIAGRAM 16 10. JAVA SERVER PAGES(JSP) 18 11. THE CODINGS 46 12. THE DATABASE TABLES 54 13. THE SNAPSHOTS OF OUR PORTAL 58 14. CONCLUSION 63 15. BIBLIOGRAPHY 64
  • 6. Page | 6 INTRODUCTION This project attempts to develop an Online Student Attendance Management System to illustrate the Online Service Using Stored Information. This online system is based on three tier client server application model. Manual control of attendance is time consuming and not effective. This project is intended to produce an automated solution for attendance management. Using this online system, daily attendance of students in schools and colleges can be easily managed. Also, teachers can manage the fine imposed, the notices and internal results of each student and the faculty profiles in an efficient manner. This online system also helps the parents to track the progress of their children using the online messaging facility. The faculties regularly send all the internal marks and the attendance sheet of the students to their parents so that they can know the activities of their children. Objective of the Project – Our aim is to make an online system which is quick easy going and encompasses all information that a student need right from viewing the internal marks, to practical marks for all subjects of the current semester. A user-id and password is provided to all the students. By using the user- id and password the students can view the marks. The main objective of the project is to bridge the communication gap and build a strong well managed communication system to avoid miss- management and dissatisfaction. FEASIBILITY STUDY 1. Economically Feasibility: The system being developed is economic with respect to School or Collage’s point of view. It is cost effective in the sense that has eliminated the paper work completely. The system is also time effective because the calculations are automated which are made at the end of the month or as per the user requirement. The result obtained contains minimum errors and are highly accurate as the data is required.
  • 7. Page | 7 2. Technical feasibility: The technical requirement for the system is economic and it does not use any other additional Hardware and software. 3. Behavioral Feasibility: The system working is quite easy to use and learn due to its simple but attractive interface. User requires no special training for operating the system. HARDWARE / SOFTWARE REQUIREMENTS  Hardware Specifications HTML, PHP and Java Script are platform independent and it will work on all configurations but to get efficiency through web it is recommended to use advance configuration base machine. Hardware Used: o Microprocessor : Intel i3 o System Bus Speed : 533 MHz o Processor Speed : 2.0 GHz o Main Memory : 256 MB o Secondary Memory : 80 GB o Secondary Memory Speed : 1024 MHz o CPU Capacity : 1.7 GHz o RAM Capacity : 4 GB  Network Specification Server Configuration: Apache Server (web)  Software Specifications o Operating System: Independent o Front End: HTML, CSS, Bootstrap
  • 8. Page | 8 o Web browser: Internet Explorer, Mozilla, Netscape, Google Chrome, opera, etc. o Back End: MySql o Other Supporting Software: Scripting language: - jQuery, Javascript, MySQL DATABASE The MySQL database has become the world's most popular open source database because of its consistent fast performance, high reliability and ease of use. It's used round the globe by individual Web developers as well as many of the world's largest and fastest-growing organizations with optimum resources powering their high-volume Web sites, business-critical systems and packaged software -- including industry leaders such as Yahoo!, Alcatel-Lucent, Google, Nokia, YouTube, and Zappos.com. Not only is MySQL the world's most popular open source database, it's also become the database of choice for a new generation of applications built on the LAMP stack (Linux, Apache, MySQL, PHP / Perl / Python.) MySQL runs on more than 20 platforms including Linux, Windows, OS/X, HP-UX, AIX, Netware, giving you the kind of flexibility that puts you in control. As of April 2009, MySQL offers MySQL 5.1 in two different variants: the MySQL Community Server and Enterprise Server. They have a common code base and include the following features:  A broad subset of ANSI SQL 99, as well as extensions  Cross-platform support  Stored procedures  Triggers  Cursors  Updatable Views  True Varchar support  Information schema and many more.
  • 9. Page | 9 MySql implements the following Distinguishing features, which some other RDBMS systems may not:  Multiple storage engines, allowing one to choose the one that is most effective for each table in the application (in MySQL 5.0, storage engines must be compiled in; in MySQL 5.1, storage engines can be dynamically loaded at run time)  Native storage engines (MyISAM, Falcon, Merge, Memory (heap), Federated, Archive, CSV, Blackhole, Cluster, Berkeley DB, EXAMPLE, and Maria)  Partner-developed storage engines (InnoDB, solidDB, NitroEDB, Infobright) Community- developed storage engines (memcached, PBXT, Revision Engine) Custom storage engines  Commit grouping, gathering multiple transactions from multiple connections together to increase the number of commits per second. DISADVANTAGES OF PRESENT WORKING SYSTEM  Not User Friendly: The existing system is not user friendly because the retrieval of data is very slow and data is not maintained efficiently.  Difficulty in report generating: We require more calculations to generate the report so it is generated at the end of the session. And the student not get a single chance to improve their attendance  Manual control: All calculations to generate report is done manually so there is greater chance of errors.  Lots of paperwork: Existing system requires lot of paper work. Loss of even a single register/record led to difficult situation because all the papers are needed to generate the reports.  Time consuming: Every work is done manually so we cannot generate report in the middle of the session or as per the requirement because it is very time consuming.
  • 10. Page | 10 CHARACTERSTIC OF THE PROPOSED SYSTEM  User Friendly: The proposed system is user friendly because the retrieval and storing of data is fast and data is maintained efficiently. Moreover the graphical user interface is provided in the proposed system, which provides user to deal with the system very easily.  Reports are easily generated: reports can be easily generated in the proposed system so user can generate the report as per the requirement (monthly) or in the middle of the session. User can give the notice to the students so he/she become regular.  Very less paper work: The proposed system requires very less paper work. All the data is feted into the computer immediately and reports can be generated through computers. Moreover work become very easy because there is no need to keep data on papers.  Computer operator control: Computer operator control will be there so no chance of errors. Moreover storing and retrieving of information is easy. So work can be done speedily and in time ANALYSIS  Functional Requirements: The college portal management system is an approach towards bridging the communication gap between the students and the college authority and making an automated system, time saving and user-friendly. The present manual system being time consuming and inconsistent tedious, may even bring about dissatisfaction and miss-management. The proposed system avoids all these problems and gives easy and simple solution to all these problems. After studying and analyzing we concluded that the following details of the software are required. The pictorial representation is the best way to represent the collection of data at the time of analysis and represents in the form of DFD (Data Flow Diagram), ERD (Entity Relationship Diagram) etc. The pictorial representation provides better understandable approach for development.
  • 11. Page | 11  Data flow Diagram A dataflow diagram is a graphical representation that depicts information flow and the transform that are applied as data move from input and output. The basic forms of a Data Flow Diagram also move from known as a Data Flow Graph or a Bubble Chart. The data flow diagram (DFD) shows the functional relationships of the values computed by a system including input values and output values and internal data store. A data flow diagram is graph showing the flow of data values. In 0-level DFD shows how a visitor can register and how the registered user can login to the software and access various options. The level-1 DFD shows that a visitor enters the registration details and these details are verified. The new registration details are send to the database registered user and the username is given to the visitor. Registered user can directly login with his/her username and process the options but if the user enters any incorrect username or password then he/she has to re-enter. Types of Data Flow Diagram: o Logical Data Flow Diagrams o Physical Data Flow Diagrams  External Entity: The External Entity symbol represents sources of data to the system, or destinations of data from the system. i.e. a Person, a System, or an organization that sends or receives data.  Data flow symbol: The Data Flow symbol represents movement of data.  Data Store Symbol: The Data Store symbol represents data that is saved on some file or in a table in the database.  Process Symbol: The Process symbol represents an activity that transforms or manipulates the data (A process transforms incoming data flow into outgoing data flow).
  • 12. Page | 12 DATA FLOW DIAGRAM: VIEW STUDENT LIST VIEW FINE LIST VIEW ATTENDANCE SHEET (DFD LEVEL 0) STUDENT ONLINE ATTENDANCE SYSTEM ADMIN FACULTY ATTENDANCE ENTRY REPORT GENERATION ADD STUDENTS MARKS ENTRY
  • 13. Page | 13 LOGIN PROCESS (LEVEL-1 DFD) LOGIN INTERFACE LOGIN VALIDATION USER HOME LOGIN VALID USER LOG NAME AND PASSWORD INVALID USER TRY AGAIN LOGIN NAME AND PASSWORD Index.jsp Login.jsp
  • 14. Page | 14 LOGIN NAME INTERFACE LOGIN STUDENT CHECK LOGIN NAME REGISTRATION PROCESS REGISTERED USER LOGIN NAME LOGIN NAME, PASSWORD REGISTRATION PROCESS (LEVEL-1 DFD)
  • 15. Page | 15 FACULTY ACTIVITY (LEVEL-2 DFD) An Entity Relationship Diagram Description: - FACULTY HOME FACULTY PROFILE MANAGEMENT SUBJECT VIEWATTENDANCE MANAGEMENTFINE VIEW VIEW STUDENT STUDENT FINE ATTENDANCE SUBJECT FACSUBJECT REGISTERED FACULTY
  • 16. Page | 16 E-R diagram is one of the pictorial representation in which the meaningful relationships are entitled between various entities. It represents the real world application. The relationship is used in data modeling to represent an association between entities. This association has certain characteristic properties represented by the attributes of the relationship set.
  • 17. Page | 17 LOGIN HAS A STUDENTADMIN APPROVES FACULTY DEPARTMENT SUBJECT FACULTY SUBJECT ATTENDANCE FINE ENTERS ENTERS HAS A HAS A HAS A VIEW VIEW
  • 18. Page | 18 JAVA SERVER PAGES (JSP) It is a technology used to create dynamic webpage. Java Server Pages is a Java-based technology that simplifies the process of developing dynamic web sites. With JSP, web designers and developers can quickly incorporate dynamic elements into web pages using embedded java. JSP files contain traditional HTML along with embedded code that allows the page designer to access data from java code running on the server. Based on the Java programming language, Java Server Pages offers proven portability, open standards, and mature re-usable component model .The Java Server Pages architecture enables the separation of content generation from content presentation. This separation not eases maintenance headaches; it also allows web team members to focus on their areas of expertise. Now, web page designer can concentrate on layout, and web application designers on programming, with minimal concern about impacting each other’s work. To make creation of dynamic content easier, Sun introduced Java Server Pages (JSP). While writing served developer require a pretty extensive knowledge of Java, a person who is new to the java can learn some pretty neat tricks in JSP in a snap. JSP represents an attractive alternative of Microsoft’s ASP (Active Server Pages). JSP provides the HTML designer with a way to access data and business logic stored inside Java objects without having to master the complexities of Java application development. When a user will access a servlet, then the runtime environment or web container executes the servlet in servlet engine, but when a jsp is accessed by the user, then the web container extracts the java code available within the jsp file and creates a servlet, then the web container compiles (by jasper) & executes (by catalina) the created servlet in the servlet container. Once the servlet is executed then the web server collects the data/output of the servlet and embed the o/p of the servlet within html tag of the jsp file to send the response back to the user.
  • 19. Page | 19 The web server will not throw away the servlet created during the first request of the user, rather the web server will store the servlet in cache memory to process the request of subsequent users. In case of servlet, the html code is written within the java syntax i.e. within println() but in case of jsp, the java code is written within scriptlet <% %> tag or we can say the java code will be written along with html tag. Although servlets are powerful web components, they are not ideal technology available to us to build presentation elements. This is because:-- 1) Amending the look and feel of the system involves recompiling the Servlet classes. 2) The presence of HTML within the Servlet tightly couples the presentation and the content, which blurs the role of presentation and providing content. Lots of HTML code within the Servlet classes makes them difficult to maintain, Java Server pages addresses these problems. JSP are text files similar to HTML files but have extra tags that allow us to:  Interact with dynamic content.  Include content from other web application resources.  Forward the response to other web application resources. Benefits of JSP:  As a Java-based Technology, it enjoys all the advantages that the java language provides with respect to development and deployment.  As an Object Based Language with a strong typing encapsulation, exception handling, and automatic memory management, use of Java leads to increase programmer productivity and more robust code.  Because compiled Java byte code is portable across all platforms that support JVM, use of JSP does not lock you into using specific hardware platform, operating system, or server software.  JSP is vendor- neutral, developers and system architects can select best-of-breed solutions at all stages of JSP deployment.
  • 20. Page | 20  JSP can readily take advantages of the other entire standard Java API’s including those for cross-platform database access, directory services, distributed computing and cryptography.  Provides support for a re-usable component such as Java-Beans Technology.  It provides the easy way to develop the code as compared to Servlet Technology of the Java. Quite a lot of things happen behind the scene when a JSP page is deployed in a web container and is first served to a client request. Features of JSP  Portability: Java Server Pages files can be run on any web server or web-enabled application server that provides support for them. Dubbed the JSP engine, this support involves recognition, translation, and management of the Java Server Page lifecycle and its interaction components.  Components: It was mentioned earlier that the Java Server Pages architecture can include reusable Java components. The architecture also allows for the embedding of a scripting language directly into the Java Server Pages file. The components current supported include Java Beans and Servlets.  Processing: A Java Server Pages file is essentially an HTML document with JSP scripting or tags. The Java Server Pages file has a JSP extension to the server as a Java Server Pages file. Before the page is served, the Java Server Pages syntax is parsed and processed into a Servlet on the server side. The Servlet that is generated outputs real content in straight HTML for responding to the client.  Access Models: A Java Server Pages file may be accessed in at least two different ways. A client’s request comes directly into a Java Server Page. In this scenario, suppose the page accesses reusable Java Bean components that perform particular well-defined computations like accessing a database. The result of the Beans computations, called result sets is stored within the Bean as properties. The page uses such Beans to generate dynamic content and present it back to the client. In both of the above cases, the page
  • 21. Page | 21 could also contain any valid Java code. Java Server Pages architecture encourages separation of content from presentation. Life cycle of JSP: A JSP life cycle can be defined as the entire process from its creation till the destruction which is similar to a servlet life cycle with an additional step which is required to compile a JSP into servlet. The following are the paths followed by a JSP The four major phases of JSP life cycle are very similar to Servlet Life Cycle and they are as follows:  JSP Compilation/ Translation Phase: In this phase the JSP page is transformed into a Java Servlet and then compiled. This phase occurs only once for each JSP page must be executed before the JSP page is served. When a browser asks for a JSP, the JSP engine first checks to see whether it needs to compile the page. If the page has never been compiled, or if the JSP has been modified since it was last compiled, the JSP engine recompiles the page. The compilation process involves three steps:  Implementation class: The translation phase results in a delay when a JSP page is requested for the first time. To avoid this delay, JSP pages can be precompiled before they are deployed using tools that perform the translation phase when the server starts up.  JSP Initialization: When a container loads a JSP it invokes the jspInit() method before servicing any requests. If you need to perform JSP-specific initialization, override the jspInit() method: public void jspInit(){ // Initialization code... } Compilation Initialization Execution Cleanup Parsing the JSP Turning the JSP into a servlet Compiling the servlet
  • 22. Page | 22 Typically initialization is performed only once and it is s similar to init() of Servlet, you generally initialize database connections, open files, and create lookup tables in the jspInit method.  JSP Execution: This phase (also known as the Request Processing phase) is executed each time the JSP page is served by the web container. Request for the JSP page result in the execution of the JSP page implementation class. This phase of the JSP life cycle represents all interactions with requests until the JSP is destroyed. Whenever a browser requests a JSP and the page has been loaded and initialized, the JSP engine invokes the _jspService() method in the JSP. The _jspService() method takes an HttpServletRequest and an HttpServletResponse as its parameters as follows: void _jspService(HttpServletRequest request, HttpServletResponse response) { // Service handling code... } The _jspService() method of a JSP is invoked once per a request and is responsible for generating the response for that request and this method is also responsible for generating responses to all seven of the HTTP methods ie. GET, POST, DELETE etc.  JSP Cleanup: The destruction phase of the JSP life cycle begins when a JSP is being removed from the web container. The jspDestroy() method is equivalent to the to the destroy() method for servlets. Override jspDestroy when you need to perform any cleanup, such as releasing database connections or closing open files. The jspDestroy() method has the following form: public void jspDestroy() { // Your cleanup code goes here. } CHARACTERSTICS OF JSP:- 1) Interpreter: A JSP file will never get compiled by the user, rather it is compiled & interpreted by the web server( javac is the compiler for servlet, jasper is the compiler of jsp(i.e. servlet created from jsp), catalina is the interpreter for servlet & jsp)
  • 23. Page | 23 2) Object base: JSP has some predefined object like request, response, exception, application, session, out etc. by which we can perform various operation. JSP doesn’t support Inheritance, Polymorphism. Hence JSP is Object Based. a) Response: This Object behaves like HttpServletResponse interface to provide response to the user. b) Request: This Object behaves like HttpServletRequest interface by which we can get data of the user. c) Exception: It is an Object of java.Lang.Throwable call by which we can handle exception in JSP. d) Application: It is an Object which is similar to ServletContext interface by which we can create application level variable. e) Session: It is an Object of HttpSession class which is used to create user session of individual user. f) Out: It is an object of PrintWriter class by which we can invoke println(). 3) Tag Based: JSP supports some predefined tags by which we can write Syntaxes. JSP also supports user defined tags. Hence JSP able to achieve code reuse without the inheritance. 4) User Friendly: Since the HTML code & tag will remain outside of JSP tag. Hence it is easy to design the HTML file by using IDE such as NetBeans, Eclipse and Dreamweaver etc. SERVLET JSP It is compiled by user & interpreted in server. It is interpreted by server It is Object Oriented. It is object based. HTML code appears within JAVA code. JAVA code will appear within HTML file. It doesn’t support user defined tags. It is support user defined tags. Creation process of JSP: 1. Create JSP file by providing .jsp extension. 2. Write java code within scriptlet tag as given bellow :- <%
  • 24. Page | 24 Java code goes here %> 3. The JSP file should be stored directly in Context Folder i.e. root directory of the website. 4. Start the server & deploy/host the website. Access the JSP file by providing file name in the URL along with URL of website. Steps in the execution of a JSP application: 1. The client sends a request to the web server for a JSP file by giving the name of the JSP file within the form tag of a HTML page or in url of href attribute of anchor tag. 2. This request is transferred to the JavaWebServer. At the server side JavaWebServer receives the request and if it is a request for a jsp file server gives this request to the JSP engine. 3. JSP engine is program which can understands the tags of the jsp and then it converts those tags into a Servlet program and it is stored at the server side. This Servlet is loaded in the memory and then it is executed and the result is given back to the JavaWebServer and then it is transferred back to the result is given back to the JavaWebServer and then it is transferred back to the client. CONTENTS OF JSP: 1. DIRECTIVE TAGS: This tag is used to import any package or file to a JSP file. Generally this tag must be given at the beginning of the JSP. Syntax: <%@ directive_name attribute=value %> Example <%@ page import=”java.util.*, java.sql.*” %> Page: - Directive Name Import: - Attribute Name <%@ page include=”login.jsp” %>
  • 25. Page | 25 Directive Description <%@ page ... %> Defines page-dependent attributes, such as scripting language, error page, and buffering requirements. <%@ include ... %> Includes a file during the translation phase. <%@ taglib ... %> Declares a tag library, containing custom actions, used in the page 2. DECLARATION SECTION/TAG: This section allows us to declare variables & objects which will be used in a JSP. This tag must be written before we can provide any response given to the client. This tag will never appear within any other tag. Syntax: <%! variables & object declaration %> Example: <%! String s1,s2=null; int a,b=0; %> 3. CLIENT END SCRIPTING TAG: This section doesn’t belongs to JSP but JSP allows us to provide client side validation by using javascript or vbscript. Example: <script language=”javascript”> Scripting language/validation code goes here </script> 4. HTML: Java allows us to provide HTML tag written JSP. 5. JSP TAG/ACTION TAG: Java has given some predefined tag in JSP to use bean class, custom tag/user defined tag in JSP. As well as Java allows us to use user defined tag/custom tag within a JSP file. This tag will never appear within any other tag. Syntax Purpose jsp:include Includes a file at the time the page is requested jsp:include Includes a file at the time the page is requested
  • 26. Page | 26 jsp:useBean Finds or instantiates a JavaBean jsp:setProperty Sets the property of a JavaBean jsp:getProperty Inserts the property of a JavaBean into the output jsp:forward Forwards the requester to a new page jsp:plugin Generates browser-specific code that makes an OBJECT or EMBED tag for the Java plugin jsp:element Defines XML elements dynamically. 6. SCRIPTLET TAG: This tag allows us to write Java syntax within a JSP file. This tag will never appear within any other tag, but this tag may appear several times in a JSP file. Syntax: <% Java codes %> 7. EXPRESSION TAG: This tag is used to print the result of an expression or a variable directly within JSP file. This tag may appear within any other tag. We can say this tag is a separate mechanism to print value of variable or expression without println(). This tag will never appear within scriptlet tag. This tag should not contain semicolon otherwise compilation error will occur. Example: <%= x+2 %> 8. JSP COMMENTS: JSP comment marks text or statements that the JSP container should ignore. A JSP comment is useful when you want to hide or "comment out" part of your JSP page. <%-- This is JSP comment --%> It is ignored by JSP engine. <!-- This is html comment --> It is ignored by browser. 9. JSP IMPLICIT OBJECTS: JSP supports nine automatically defined variables, which are also called implicit objects. Objects Description
  • 27. Page | 27 request This is the HttpServletRequest object associated with the request. response This is the HttpServletResponse object associated with the response to the client. out This is the PrintWriter object used to send output to the client. session This is the HttpSession object associated with the request. application This is the ServletContext object associated with application context. config This is the ServletConfig object associated with the page. pageContex t This encapsulates use of server-specific features like higher performance JspWriters. It is an object of javax.servlet.jsp.PageContext page This is simply a synonym for this, and is used to call the methods defined by the translated servlet class. It’s an object of javax.servlet.jsp.HttpJspPage exception The Exception object allows the exception data to be accessed by designated JSP. Example(First.jsp) Second.jsp <html><body bgcolor="pink"> <h1> Welcome to First jsp <br> <% int x=12, y=23; int z= x+y; out.println("sum of "+x+" and "+y+"="+z); %> </h1></body></html> <html><body bgcolor="cyan"> <h1> Welcome to Second jsp <br><table border=2> <% for(int i=0; i<5; i++) { out.println(“<tr>”); for(int j=0; j<10; j++) { out.println("<td> kalia</td>"); } out.println(“</tr>”); } %> </h1></body></html>
  • 28. Page | 28 Submitting Request JSP to itself : If in a jsp file if we have not given the action attribute of the form tag then the data of the jsp page will be submitted to itself. Itself.jsp : <html><body bgcolor=”cyan”> <%! String na, pw; %> <% try{ na=request.getParameter(“t1”); pw=request.getParameter(“t2”); }catch(Exception e){ } if( na==null || na.equals(“”)){ %> <form method=”get”><h1> user name<input type=”text” name=”t1”><br> password<input type=”password” name=”t2”><br> <input type=”submit” value=”submit” /><input type=”reset” value=”reset” /></h1></form> <% } else { out.printin(“Welcome”+na+”ur pass”+pw); } %> </body></html> Using DataBase in JSP with life cycle methods : Store as Stud.html: <html> <head><title> Student details </title></head> <body><form method="get" action="./getstud.jsp"><table border='1' align="center"> <tr> <td>Student Roll Number</td>
  • 29. Page | 29 <td><input type="text" name="rno" value=""></td> </tr> <tr> <td><input type="submit" name="button" value="Submit"></td> </tr> </table></form></body> </html> Store it as getstud.jsp : <%-- JSP page design steps 1. In jspInit() method create Connection, Statement, PreparedStatement objects by reading driver information from web.xml file Note: In jsp based project web.xml is mandatory only if 1. jsp file want to be configured as welcome file 2. to read jsp initialization parameters 2. In _jspService() method [Scriptlet tag] read student information from DB and display it to end user with HTML table component 3. In jspDestroy() method release all JDBC objects. --%> <%@ page import = "java.sql.*"%> <%! Connection con; Statement stmt; ResultSet rs; %>
  • 30. Page | 30 <%public void jspInit(){ try{ /* reading jsp intialialization values from web.xml file, means from ServletConfig object. retrieving ServletConfig object */ ServletConfig config = getServletConfig(); ServletContext ctxt = config.getServletContext(); String driver = ctxt.getInitParameter("driver"); String url = ctxt.getInitParameter("url"); String usn = config.getInitParameter("usn"); String pwd = config.getInitParameter("pwd"); //preparing JDBC objects Class.forName(driver); con = DriverManager.getConnection(url, usn, pwd); stmt = con.createStatement(); }catch(Exception e){ e.printStackTrace(); } } public void jspDestroy(){ //releasing JDBC objects try{ if(stmt != null) { stmt.close(); stmt = null; } if(con != null){ con.close(); con = null; } }catch(Exception e){
  • 31. Page | 31 e.printStackTrace(); } } %> <% try{ //reading sno from html form String rol = request.getParameter("rno").trim(); String query; //checking user decision if(rol == null || rol.equals("")){ //user want to list all students details query = "SELECT * FROM stud"; }else { //user want to retrieve only given student information query = "SELECT * FROM stud WHERE roll =” + rol; } rs = stmt.executeQuery(query); //preparing presentation logic %> <html> <head> <title> student details </title></head> <body> <h1> Here the student roll number <%= rol %> details <table border="1" align="center"> <tr> <th>Name</th> <th>Roll</th> <th>Sem</th> <th>Mark </th> </tr> <% while (rs.next()) { %> <tr> <td><%= rs.getString(1) %></td> <td><%= rs.getInt(2) %></td> <td><%= rs.getString(3) %></td> <td><%= rs.getFloat(4) %></td> </tr> <% } %> </table></form></body>
  • 32. Page | 32 </html> <% rs.close(); }catch(Exception e){ e.printStackTrace(); } %> web.xml : <web-app....... > <context-param> <param-name>driver</param-name> <param-value>com.mysql.jdbc.Driver</param-value> </context-param> <context-param> <param-name>url</param-name> <param-value>jdbc:mysql://localhost/college</param-value> </context-param> <servlet> <servlet-name>select</servlet-name> <jsp-file>/getstud.jsp</jsp-file> <init-param> <param-name>usn</param-name> <param-value>root</param-value> </init-param> <init-param> <param-name>pwd</param-name> <param-value></param-value> </init-param> </servlet>
  • 33. Page | 33 <servlet-mapping> <servlet-name>select</servlet-name> <url-pattern>/getstud.jsp</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>Stud.html</welcome-file> </welcome-file-list> </web-app> USER TRACKING : It can be achieved by followings: - 1. Url rewriting 2. Hidden field 3. Cookie 4. Session 1) URL rewriting (Store it as URLDemo.html ) <html><body bgcolor="yellow"> <form action="UDemo1.jsp" method ="get"><h1> User Name <input type="text" name="t1" value="ur name"><br> Password <input type="password" name="p1"><br> <input type="submit" value="Submit"><input type="reset" value="Reset"> </h1></form></body></html> UDemo1.jsp UDemo2.jsp : <html><body bgcolor=cyan> <%! String s1, s2; %> <h1>Welcome to URL rewriting<br> <% s1 = request.getParameter("t1"); s2 = request.getParameter("p1"); %> <a href="UDemo2.jsp?a1=<%= s1 %> &a2=<%= s2 %>"> Click Me</a> <html><body bgcolor=cyan> <%! String s1, s2; %> <% s1 = request.getParameter("a1"); s2 = request.getParameter("a2"); %> <h1>Welcome <%= s1 %> ur password is <%= s2 %>
  • 34. Page | 34 </h1></body></html> </h1></body></html> 2) Hidden field: (Store it as HidDemo.html ) <html><body bgcolor="yellow"> <form action="Hid1.jsp" method ="post"><h1> User Name <input type="text" name="t1" value="ur name"><br> <input type="submit" value="Submit"> </h1></form></body></html> Hid1.jsp Hid2.jsp <html><body bgcolor=cyan> <%! String s1; %> <h1>Welcome to Hiiden Field<br> <% s1 = request.getParameter("t1"); %> <form action ="Hid2.jsp" method="post"> <input type="hidden" name="t1" value="<%= s1 %>"> Enter ur phone no<input type="text" name="t2"> <input type="submit" value="submit"> </form></h1></body></html> <html><body bgcolor=cyan> <%! String s1, s2; %> <% s1 = request.getParameter("t1"); s2 = request.getParameter("t2"); %> <h1>Welcome <%= s1 %> ur phno is <%= s2 %> </h1></body></html> 3) Cookie : (Store it as CookDemo.html ) <html><body bgcolor="magenta"> <form action="Cookie1.jsp" method ="get"><h1> User Name <input type="text" name="t1" ><br> password <input type="password" name="t2" ><br> <input type="submit" value="Submit"> </form></body></html>
  • 35. Page | 35 Cookie1.jsp Cookie2.jsp <html><body bgcolor="cyan"> <% String s1= request.getParameter("t1"); String s2= request.getParameter("t2"); Cookie c1=new Cookie("name", s1); Cookie c2=new Cookie("pwd", s2); response.addCookie(c1); response.addCookie(c2); %> <h1>Welcome to Cookie <a href="Cookie2.jsp"> Testing ur Cookie</a></h1></body></html> <html><body bgcolor="pink">Cookie example <br> <% Cookie ck[]= request.getCookies(); for(int i=0; i< ck.length;i++) { %> Variable name : <%= ck[i].getName() %> value is : <%= ck[i].getValue() %><br> <% } %> </h1></body></html> 4) Session: (Store it as SessDemo.html) <html><body bgcolor="yellow" > <form action="Sess1.jsp"><h1> Enter ur name &nbsp;&nbsp;<input type="text" name="t1"> <br> Enter password &nbsp;&nbsp;<input type="password" name="t2"><br> <input type="submit" value="Submit"></h1></form></body></html> Sess1.jsp Sess2.jsp <html><body bgcolor=red> <h1>Welcome to session<br> <%! String s1, s2; %> <% s1=request.getParameter("t1"); s2=request.getParameter("t2"); session.setAttribute("uname",s1); session.setAttribute("pwd", s2); %> <a href="Sess2.jsp">Click</a> </h1></body></html> <html><body bgcolor=pink> <h1>The value of ur session is :2nd JSP<br> <%! String p1, p2; %> <% p1=(String) session.getAttribute("uname"); p2=(String) session.getAttribute("pwd"); %> user name : <%= p1 %> <br> password : <%= p2 %> </h1></body></html
  • 36. Page | 36 INCLUDING AND FORWARDING THE REQUEST: When HTML will send the reqeust to first JSP, then the first JSP will process the request and provide the response back to the browser. But the users request will not be available to 2nd / 3rd JSP. The request forwarding mechanism allows us to propagate the same request of the user to 1st, 2nd, 3rd JSP and so on. The last JSP will provide the response to the user, other JSP will remain invisible to the user. The request forwarding mechanism in servlet provide extra information to the other servlet. This mechanism is also available in accessing a JSP from servlet in JSP chapter because it will forward the same request and response of the user or to the other servlet. But in case of JSP we can also add extra information from one JSP to other alongwith the users request. The request forwarding mechanism in JSP can be achieved by <jsp:forward> as givewn below <jsp:forward Page = “For2. JSP” > <jsp:param name= “name” value = “<%= s2 %>”/> </jsp:forward> The <jsp: forward> is a predefined JSP tag and it will hold the address of next JSP file in page attribute to which the users request will be forwarded. Let us say, we have written the above code in For1. jsp, the request available to For1. jsp will be forwarded to For2. Jsp, as well as For1. jsp may process the users reqeust on the data base or can implement any logic on the users request, then For1. jsp may forward the users request to For2. jsp. The For1. jsp is also able to provide extra information or value to For2.jsp by using jsp: param subtag of < jsp:forward>. The for2.jsp will get the users request by using getParameter() as well as the value given in <param > by providing the name given in <param> in getParameter() If we do not provide the jsp:param subtag then we can write the<jsp:forward> in one line as <jsp:forward page = “for2.jsp” /> Similarly, the <jsp: include >allows us to include content of another jsp./HTML file into current jsp file. <jsp:include page = “login.html”/>
  • 37. Page | 37 STATIC INCLUDE : In this mechanism the content of one jsp file is included within another jsp.file. It is similar to <jsp:include> in case of static include the content of one jsp file will be included within another jsp before the jsp is converted into servlet. But in case <jsp: include> the result / response/ output of one jsp file is included within another jsp file. The static include helps us to avoid the duplicacy of a code to use same code in all pages. e.g. We can create dbcon.jsp in which we will write the database connection statement ,so that it will be included in any jsp page of the website.but in case of <jsp:include> we can use same design or output of one webpage in one jsp file. EXCEPTION HANDLING IN JSP : When an exception occurs in a jsp, then the info of the exception is directly displayd on the browser. This mechanism redirects the exception/error of a jsp file to an error page (error page is also another jsp). When exception occurs in a jsp then control will be transferred to error page for handling the exception as well asto avoid the exception stack/info on the browser. The jsp file in which the exception may occur must provide the jsp file name which will handel the exception in errorPage attribute of page directive. Ex : <%@ page errorPage=”B.jsp” /> , say we have written this statement in A.jsp & when exception will occur in A.jsp then control will be transferred to B.jsp file. To implements this mechanism we can creae one jsp file(say B.jsp) to handel the exception(papularly called error page) for entire website. This page must provide “true” to isErrorPage attribute of page directive, this page must use predefined exception object to deal with exception, Ex : <%@ page isErrorPage=”true” /> , say we have written this statement in B.jsp, hence this file handel the exception. JAVA BEAN : Java Bean is a reusuable component (bean is a simple java class) Java bean provides a mechanism to create development component. The components are part of the system / software which is used to perform a well defined task. A component may be a visible component / it may be an invisible component.
  • 38. Page | 38 A visible component works with the user interface of the s/w whereas an invisible component will work behind the user interface of the s/w. A normal java class with a set of convention for its properties and behavior (data member and member function) is known as java bean. The properties of the bean class must be accessed / modified by the methods of Bean class. Contents of Java Bean a. Properties (data member) b. Method c. Event a) Properties: The variables declared within java class is called properties of the Bean class .The properties represents state of the java bean. A Bean class has 5 types of properties as given below: i. Simple Property ii. Indexed Property iii. Boolean Property iv. Bound Property v. Constraint Property i. Simple Property : If the data member of Bean class doesnt belong to boolean datatype of an array,then it is called Simple Property. a. E.g int x; String name; ii. Indexed Property : If the data member of Bean class is an array which can be modified by using index/counter,then it is called Indexed property . i. E.g int a[]; iii. Boolean Property : If the data member of Bean class belongs to boolean datatype then it is called boolen property which may hold true/false value. i. E.g boolen z; iv. Bound Property : If the data member of Bean classs will change by changing the value of another Property then this type of variable is called Bound Property. Whenever the value of Bound Property will change then an object of
  • 39. Page | 39 java.beans.PropertyChangeEvent class is generated. To handle this event PropertyChangeListener interface is used. i. E.g if salary &job are 2 datamemberof Bean class ,when the value of job properties change, then we will change value of salary Property. v. Constraint Property : If depending upon the value of a data member of the Bean class a condition must be satisfied, then it will be called Constraint Property. If the condition does not satisfy then the Bean class will terminate the execution and the property will not change its value ,such type of property accquires vetopower. Whenever the value of Constraint Property changes then an object of PropertyChangeEvent class is generated and to handle it VetoableChangeListener interface is used. b) Method: The method of Bean class are used to provide and accesss the values of the properties i.e data members.Basically methods are of two types known as : i. Property Setter/Modifier method ii. Property Getter/Accesser method i. Property accesser method: This methods are used to fetch the value of Property. This method names must start with a prefix called get followed by the property name .The return type of these method must be remain same to that of the data type of the Property , and these method should not accept any parameter. E.g Let us say the property is String name, then the property setter method is : public String getName() ii. Property modifier method : This methods are used to modify/set the value of a Property .The name of the method must start with a prefix called set followed by the Property name. The return type of this function must always be void. This function must accept a parameter whose datatype must remain the same to that of the datatype of the Property. Eg: If name is the Property, then the method will be public void setName(String b) User defined Tag/Custom Tag This is a process of creating user defined tag. This tag used to perform any kind of task. It provides the following advantages-
  • 40. Page | 40 1) Code reusability:- After the creation of tag it can be used by any no. of JSP to perform the same tag. Hence the custom tag class or the code behind the tag becomes reusable. 2) Code abstraction:- User of the tag shouldn’t know the implementation logic of the custom tag which allow a programmer to remove the task from the JSP. 3) Avoiding duplication:- A custom tag may perform a common task required for more than one jsp. Hence the required code to perform the common task can be kept within the tag class. Requirement for creating Custom tag:- a) Tag class :- This class contains logic for the tag. b) TLD (Tag library discripter ):- As the info^ of the servlet is given in “web.xml” file, similarly the info of custom tag is given in .TLD file. It’s a xml type file. As in jsp we use <jsp:useBean> tag to get information about the Bean class, similarly in the jsp file use taglib attribute of page directive ( <%@ taglib...>) . to acess the tag class as well as o create the tag name (tag name is the similar to object of Bean class in jsp) c) Creation process of tag class:- (i) Create a class by inheriting from TagSupport class available in javax.servlet.jsp.tagext package and the user defined class must remain as public. (ii) Provide variables within this class which will become attributes of the custom tag. (iii) The setter ( ) is used to provide the value of attributes(variables). (iv) Override the method of TagSupport class to represent the logic for <start> and <end> For starting tag the method is public int doStartTag ( ), for ending tag the method is public int doEndTag(). This method return an integer value by the constant present in TagSupport of the class. These constants are:- 1) TagSupport.EVAL_ BODY_ INCLUDE : This constant can be applied only as the return value of doStartTag ( ). This makes the body of the tag to execute (the content available within starting & ending tag in jsp file will execute) 2) TagSupport.SKIP_BODY : This constant can be applied only to doStartTag ( ). It doesn’t allow the body of tag to execute.
  • 41. Page | 41 3) TagSupport.EVAL_PAGE : This constant can only be used for doEndTag ( ). This makes the remaining part of the page to execute. 4) TagSupport.SKPI_PAGE : This constant can be applied only for doEndTag ( ). This doesn’t allow remaining part of the page to execute. d) Create an object of JspWriter class by using getOut ( ) of pageContext object. This is required for printing the o/p lines of the tag from doStartTag ( ) or doEndTag ( ). e) The user defined tag class must be stored within a package, and the package must be stored under classes’ folder of WEB-INF folder of root directory. f) Compile the user defined Tag class by providing servlet-api.jar & jsp-api.jar in class path. Creation process of TLD: The extension of this file must be .TLD within any name. Copy any .TLD file available in Tomcat home directory and paste it under WEB-INF folder. Open this file in edit mode and remove all the tag within </short_name> and </taglib>. Use the following tags before </taglib> but after </short name> as given below:- …………………… </short_name> <tag> - it is used to provide info of user defined tag class. <name> - it is name by which jsp will access the user defined tag class. (It is similar to the url pattern of servlet.) </name> <tag-class> Provide the full qualified name of the custom tag class </tag-class> <attribute> - it is used to provide info about the attribute of tag. <name> col </name> - name of attribute of tag, and it must be same name as that of the data member of user defined tag class. <required> true </required> - if value of this is true then this attribute of tag is a mandatory attribute, if false then this attribute is optional. <rtexprvalue> true <rtexprvalue> - if it is true then the attribute will accept value dynamically at run-time, such as by expression tag. If it is false then the attribute will not accept run-time value. </attribute> <attribute> - info of 2nd attribute <name> ……… </name>
  • 42. Page | 42 <required> ……………..</reqired> <rtexprvalue>………….</rtexprvalue> </attribute> </tag> Using the user defined Tag / custom tag in Jsp:- As Jsp uses <jsp:useBean> to use a bean class similarly to use the <custom> the Jsp must provide taglib directive tag as given below <%@ taglib uri =”/WEB_INF/Test.tld” prefix = “p1” %> The uri attribute of taglib directive gets the info of custom tag from .tld file. Hence it must hold the name of the .tld file along with the WEB-XML folder. Because Jsp file is stored in context folder. prefix attribute holds an user defined name, which will behave like an object of .tld file by which we can access different tag names available in .tld file. PageContext: PageContext represents a class that provides methods that are implementation-dependent. The PageContext class itself is abstract, so in the _ jspService method of a JSP servlet class, a PageContext object is obtained by calling the getPageContext method of the JspFactory class. The PageContext class provides methods that are used to create other objects. For example, its getOut method returns a JspWriter object that is used to send strings to the web browser. Other methods that return servlet-related objects include the following: • getRequest, returns a ServletRequest object • getResponse, returns a ServletResponse object • getServletConfig, returns a ServletConfig object • getServletContext, returns a ServletContext object • getSession, returns an HttpSession object The JspWriter Class :
  • 43. Page | 43 The JspWriter class is derived from the java.io.Writer class and represents a Writer that you can use to write to the client browser. Of its many methods, the most important are the print and println methods. Both provide enough overloads that ensure you can write any type of data. Additional methods allow you to manipulate the buffer. For instance, the clear method clears the buffer. It throws an exception if some of the buffer's content has already been flushed. Similar to clear is the clearBuffer method, which clears the buffer but never throws any exception if any of the buffer's contents have been flushed. Accessing a Jsp from the Servlet. ServRec.html : <html> < body bgcolor = “cyan”> <h1> <form action = “../servJsp” method = get> Name : <input type = “text” name = “t1”> <br> Password : <input type = “password” name = “t2”><br> <input type = “submit” value =”submit”> </hi> </form> </body> </html> The above html file is accessing the Serv2jsp.java (servlet) whose url pattern is servJsp in web.xml. but this ServRec.html file is not stored in context folder (i.e./under google) rather the ServRec.html is stored under c:....webappgoogleserv folder, hence we must provide the root folder name in order to access the srevlet. Since the serv folder is within google folder hence in action we have given ../ServJsp, here .. refers to parent folder i.e. to the google. Serv2Jsp.java Import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Serv2Jsp extends HttpServlet { public void doGet (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try {
  • 44. Page | 44 request.setAttribute ("s1", "Serv2Jsp"); //Set the attribute & value to forward to hello.jsp ServletConfig scf = getServletConfig(); ServletContext sc =scf.getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher("/serv/hello.jsp"); rd.forward(request, response); } catch (Exception ex) { ex.printStackTrace (); } }}; Hello.jsp : <html> <body bgcolor=”pink”> <h1> 1 have been invoked by <% out.print(request.getAttribute(“s1”).toString() ); %> Servlet .<br> your name : <%= request.getParameter(“t1”) %><br> your password : <%= request.getParameter(“t2”) %> <h1> </html> getServletConfig( ) :- This method GenericServlet class returns a reference of ServletConfig interface. This interface is used by a servlet container to pass info to a servlet during initialization. Since this interface we have used in above servlet, hence the value will be the passed to the Hello.jsp by the web server. Because this servlet program is forwarding the users request to the Hello.Jsp. therefore the value given by sevlet container by using ServletConfig interface, apart from the users request exra information can be passed from srvlet to Hello.Jsp by setAttribute (). setAttribute (String variable name,String variable value) : This method of HttpServletRequest interface is used to provide extra value from the servlet to other servlet/Jsp. This method will accept the user defined variable name along with a value as pecified by 1st & 2nd parameter respectively, so that the other servlet/jsp will access the value by providing the variable name in getAttribute() of HttpServletRequest interface in servlet/by request object in Jsp file.
  • 45. Page | 45 Attributes of <jsp:plugin>  type = “bean/applet” -- The type of object the plug-in will execute. You must specify either bean/applet, as this attribute has no default value.  code = “class file name” -- The name of java class file the plug-in will execute. You must include the .class extension in the name. The file you specify should be in the directory named in the codebase attribute.  codebase = “class file directory name” -- The directory (or path to the directory) that contains the java class file the plug-in will execute. If you don’t supply a value, the path of Jsp file that calls <Jsp.plugin> is used.  name = “instance Name” -- A name for the instance of the Bean or applet. Which makes it possible for applet or Beans called by the same Jsp file to communicate with each other. <jsp:params> <jsp:params name =”parameter Name” value = “{parameter value/<% =expression%>} ”/> </jsp:params> The parameters and value that you want to pass to the applet or bean. To specify more than one <jsp:param> we have to specify one <jsp:param> element within the other <jsp:params> elements. The name attribute specifies the parameter name and takes a case- sensitive literal string. The value attribute specifes the parameter value and takes either a case- sensitive literal string or an expression that is evaluated at runtime. <jsp:fallback> text msg for user </jsp:fallback> -- A text msg to display for the user if the plug- in can’t be started. If the plug-in starts but the applet or bean doesn’t, the plug-in usually displays a popup window explaining the error.
  • 46. Page | 46 THE CODINGS: 1. index.jsp <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CseDept</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link href="css/bootstrap.css" rel='stylesheet' type='text/css' /> <link href="css/custom.css" rel='stylesheet' type='text/css' /> <script type='text/javascript' src="js/jquery-1.11.3.min.js"></script> <script src="js/bootstrap.js"></script> <script src="js/jquery.js"></script </head> <body> <jsp:include page="head.jsp" /> <div class="container"> <div id="metro" class="row" style="padding:10px 10px;margin-top:50px;"> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px;"> <div class="brick1"> <a href="#" class="nav-item" data-toggle="modal" data-target="#myModal"> <div class="nav-hover"></div> <img src="img/attendence.png" class="img-responsive" /> <span>Attendence</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px; background:#09C;"> <div class="brick1 odd"> <a href="notices.jsp" class="nav-item"> <div class="nav-hover"></div> <img src="img/notice.png" class="img-responsive" />
  • 47. Page | 47 <span>Notices</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px;"> <div class="brick1 odd"> <a href="result.jsp" class="nav-item"> <div class="nav-hover"></div> <img src="img/results.png" class="img-responsive" /> <span>Results</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px; background:#09C;"> <div class="brick1"> <a href="signup.jsp" class="nav-item"> <div class="nav-hover"></div> <img src="img/reg.png" class="img-responsive" /> <span>Register</span> </a> </div> </div> </div> </div> </div> <div class="clearfix"> </div> <div id="bg" style="margin-top:50px;"> <div class="container"> <div class="jumbotron" id="article"> <h3>Welcome to Computer Science Official Website!</h3> </div>
  • 48. Page | 48 </div> </div> <jsp:include page="foot.jsp" /> <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times; </button> <h4 class="modal-title" id="myModalLabel">Enter Your Registration</h4> </div> <div class="modal-body bg bg-warning"> <form class="form-horizontal" action="attendance.jsp?reg=<%=request.getParameter("reg1")%>" method="get" style="text- align:center;"> <div class="form-group"> <div class="col-lg-4 col-lg-offset-4"> <input type="text" maxlength="10" placeholder="Registration" name="reg1" id="reg1" class="form-control" required> </div> </div> <div class="form-group"> <input type="submit" name="submit" value="Submit" class="btn btn-primary"> <button type="button" class="btn btn-default" data-dismiss="modal">Close </button> </div> </form> </div> <div class="modal-footer"> </div> </div><!-- /.modal-content --> </div><!-- /.modal --> </body> </html>
  • 49. Page | 49 2. Adminhome.jsp <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CseDept</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link href="css/bootstrap.css" rel='stylesheet' type='text/css' /> <link href="css/custom.css" rel='stylesheet' type='text/css' /> <script type='text/javascript' src="js/jquery-1.11.1.min.js"></script> <script src="js/bootstrap.js"></script> <script src="js/jquery.js"></script> </head> <body> <jsp:include page="head.jsp" /> <div class="container-fluid" style="background:#5ce3a2;color:white;text-align:center;font- size:20px;"> Welcome Prof. <%=(String)session.getAttribute("logname")%> to admin page. </div> <div class="container"> <div id="metro" class="row" style="padding:10px 10px;margin-top:80px;"> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px;"> <div class="brick1"> <a href="signup.jsp" class="nav-item" target="_new"> <div class="nav-hover"></div> <img src="img/add.png" class="img-responsive" /> <span>Add Student</span> </a> </div> </div>
  • 50. Page | 50 <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px; background:#09C;"> <div class="brick1 odd"> <a href="notice_gen.jsp" class="nav-item" target="_new"> <div class="nav-hover"></div> <img src="img/notice.png" class="img-responsive" /> <span>Create Notice</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px;"> <div class="brick1 odd"> <a href="mark_en.jsp" class="nav-item" target="_new"> <div class="nav-hover"></div> <img src="img/results.png" class="img-responsive" /> <span>Marks Entry</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px; background:#09C;"> <div class="brick1"> <a href="reg.jsp" class="nav-item" target="_new"> <div class="nav-hover"></div> <img src="img/reg.png" class="img-responsive" /> <span>Register</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px;background:#09C;"> <div class="brick1">
  • 51. Page | 51 <a href="atten_select.jsp" class="nav-item" target="_new"> <div class="nav-hover"></div> <img src="img/attendence.png" class="img-responsive" /> <span>Attendence</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px; "> <div class="brick1 odd"> <a href="fine_per.jsp" class="nav-item" target="_new"> <div class="nav-hover"></div> <img src="img/fine.png" class="img-responsive" /> <span>Fine Manager</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6" style="padding:0px;background:#09C;"> <div class="brick1 odd"> <a href="facsub.jsp" class="nav-item" target="_new"> <div class="nav-hover"></div> <img src="img/results.png" class="img-responsive" /> <span>Faculty Manager</span> </a> </div> </div> <div class="col-lg-3 col-md-2 col-sm-3 col-xs-6 bg-primary" style="padding:0px; "> <div class="brick1"> <a href="reg.jsp" class="nav-item" target="_new"> <div class="nav-hover"></div>
  • 52. Page | 52 <img src="img/sms.png" class="img-responsive" /> <span>Send Report</span> </a> </div> </div> </div> </div> <footer style="margin-top:73px;"> <jsp:include page="foot.jsp" /> </footer> </body> </html> 3. Fachome.jsp <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CseDept</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum- scale=1"> <link href="css/bootstrap.css" rel='stylesheet' type='text/css' /> <link href="css/custom.css" rel='stylesheet' type='text/css' /> <link href="css/sidebar.css" rel='stylesheet' type='text/css' /> <script type='text/javascript' src="js/jquery-1.11.3.min.js"></script> <script src="js/bootstrap.js"></script> <style type="text/css"> #hm a:link{border-left:5px solid white;} </style> </head> <body>
  • 53. Page | 53 <jsp:include page="head.jsp" /> <jsp:include page="below_head.jsp" /> <div class="container-fluid"> <div id="wrapper"> <jsp:include page="facmenu.jsp" /> <div id="page-content-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-lg-12"> <img src="img/login-bg.png" height="375px"> </div> </div> </div> </div> </div> </div> <div class="clearfix"></div> <jsp:include page="foot.jsp" /> <script> $("#menu-toggle").click(function(e) { e.preventDefault(); $("#wrapper").toggleClass("toggled"); }); </script> </body> </html>
  • 54. Page | 54 THE DATABASE TABLES (The admin table) (The attendance table)
  • 55. Page | 55 (The department table) (The faculty table)
  • 56. Page | 56 (The faculty subject table) (The login table)
  • 57. Page | 57 (The student table) (The subject table)
  • 58. Page | 58 THE SNAPSHOTS OF OUR PORTAL (Home page) (Admin home page)
  • 59. Page | 59 (Faculty home page) (The fine manager page)
  • 60. Page | 60 (Login page) (Notice generation page)
  • 61. Page | 61 (Faculty profile page) (ATTENDANCE ENTRY)
  • 63. Page | 63 CONCLUSION The Attendance Management System is developed using Adv. Java and MySQL fully meets the objectives of the system which it has been developed. This system helps to reduce the time of faculties and cost of the paper and ink used in the previous attendance system. The system has reached a steady state where all bugs have been eliminated. The system is operated at a high level of efficiency and all the teachers and user associated with the system understands its advantage. The system solves the problem. It was intended to solve as requirement specification.
  • 64. Page | 64 BIBLIOGRAPHY 1. www.w3schools.com 2. www.tutorialspoint.com 3. www.google.com 4. www.stackoverflow.com 5. www.slideshare.com