Java and JSP Project on Online News Portal System

March 26, 2017 | Author: FreeProjectz.com | Category: N/A
Share Embed Donate


Short Description

Download Java and JSP Project on Online News Portal System...

Description

Introduction to Project Online News Portal Online news portal allows customers to read up to date news related to many fields like entertainment, national, international, business, sports etc. without any payment or login. He can also contact us to give suggestions and can also give us feedback related to our site. New News can be added only by the admin and only admin have the right to update or delete any News. Admin have the right to give authority to other for news update, add or Delete. The traditional media rooms all around the world are fast adapting to the new age technologies. This marks the beginning of news portals by media houses across the globe. This new media channels give them the opportunity to reach the viewers in a shorter span of time than their print media counterparts.

Advantages 

News on the Internet can be updated round the clock so that readers can have the most up-to-date news any time of the day or night.



Once a news item is put on the Internet, it becomes instantly available for use round the globe without additional variable costs.



The lead time required between occurrence of an event and news making on it available on the Internet has reduced considerably. Some items of news like stock market prices are now available almost in real-time.



News provider can get detailed data on popularity of news items. This information can help in better choice of information put on the site.



The type of news and the way it is presented can be customized to the needs and preference of individual readers



You don't have to wait for newspaper in morning.



Any time any news related to different fields will be available.



Money and time will also save.

Disadvantages 

Newspapers are more convenient to read. One can easily relax, reclined over a deck chair, and reading a newspaper. This Kind of ease in reading is not possible with Internet-news.



Newspaper can be carried and read at any location of the world. There is no precondition of availability of Internet connectivity.



Newspaper can be carried and read at any location of the world. There is no precondition of availability of Internet connectivity.



Reading newspaper does not require any equipment such as a computer.



It is important to note that Internet capabilities are improving very fast, and with that the Internet-news is moving toward overcoming its current disadvantages over newspaper.

Project Category Relational Database Management System (RDBMS) : This is an RDBMS based project which is currently using MySQL for all the transaction statements. MySQL is an opensource RDBMS System. Brief Introduction about RDBSM : A

relational

database

management

system

(RDBMS)

is

a

database

management system (DBMS) that is based on the relational model as invented by E. F. Codd, of IBM's San Jose Research Laboratory. Many popular databases currently in use are based on the relational database model. RDBMSs have become a predominant choice for the storage of information in new databases used for financial records, manufacturing and logistical information, personnel data, and much more since the 1980s. Relational databases have often replaced legacy hierarchical databases and network databases because they are easier to understand and use. However, relational databases have been challenged by object databases, which were introduced in an attempt to address the object-relational impedance mismatch in relational database, and XML databases. RDBMS Architecture Diagram

SYSTEM ANALYSIS EXISTING SYSTEM: System Analysis is a detailed study of the various operations performed by a system and their relationships within and outside of the system. Here the key question is- what all problems exist in the present system? What must be done to solve the problem? Analysis begins when a user or manager begins a study of the program using existing system. During analysis, data collected on the various files, decision points and transactions handled by the present system. The commonly used tools in the system are Data Flow Diagram, interviews, etc. Training, experience and common sense are required for collection of relevant information needed to develop the system. The success of the system depends largely on how clearly the problem is defined, thoroughly investigated and properly carried out through the choice of solution. A good analysis model should provide not only the mechanisms of problem understanding but also the frame work of the solution. Thus it should be studied thoroughly by collecting data about the system. Then the proposed system should be analyzed thoroughly in accordance with the needs. System analysis can be categorized into four parts.  System planning and initial investigation  Information Gathering  Applying analysis tools for structured analysis  Feasibility study  Cost/ Benefit analysis.

In the current system we need to keep a number of records related to the student and want to enter the details of the student and the marks manually. In this system only the teacher or the school authority views the mark of the student and they want to enter the details of the student. This is time consuming and has much cost.

PROPOSED SYSTEM: In our proposed system we have the provision for adding the details of the students by themselves. So the overhead of the school authorities and the teachers is become less. Another advantage of the system is that it is very easy to edit the details of the student and delete a student when it found unnecessary. The marks of the student are added in the database and so students can also view the marks whenever they want. Our proposed system has several advantages: User friendly interface  Fast access to database  Less error  More Storage Capacity  Search facility  Look and Feel Environment  Quick transaction

All the manual difficulties in managing the student details in a school or college have been rectified by implementing computerization.

FEASIBILITY ANALYSIS Whatever we think need not be feasible .It is wise to think about the feasibility of any problem we undertake. Feasibility is the study of impact, which happens in the organization by the development of a system. The impact can be either positive or negative. When the positives nominate the negatives, then the system is considered feasible. Here the feasibility study can be performed in two ways such as technical feasibility and Economical Feasibility. Technical Feasibility: We can strongly says that it is technically feasible, since there will not be much difficulty in getting required resources for the development and maintaining

the

system

as

well.

All

the

resources

needed

for

the

development of the software as well as the maintenance of the same is available in the organization here we are utilizing the resources which are available already. Economical Feasibility: Development of this application is highly economically feasible .The organization needed not spend much money for the development of t he system already available. The only thing is to be done is making an environment for the development with an effective supervision. I f we are doing so , we can attain the maximum usability of the corresponding resources .Even after the development , the organization will not be in condition to invest more in t he organization .Therefore , the system is economically feasible.

Software Requirement Specification The Software Requirements Specification is produced at the culmination of the analysis task. The function and performance allocated to software as part of system engineering are refined by establishing a complete information description, a detailed functional and behavioral description, an indication of performance requirements and design constraints, appropriate validation criteria, and other data pertinent to requirements. 1. Introduction 1.1.

Purpose –

come of

The main purpose, to make this software is to over

problems of data base handling, maintain registers of

members, Credentials,

and

information about worker which are

works at Library etc. 1.2.

Intended Audience – This SRS is meant for basically my final

semester project report of MCA. Besides, it is obviously targeted for the managers of mentioned center, the client, to get and overall description and advantage of the proposed system over the existing manual system. 1.3.

Product Vision and Scope – The proposed system is being

developed keeping in mind the requirements/need of the client to automate its existing system for record keeping, report generation and management level information

system. Keeping in mind the

needs, the system has been developed as per guidelines laid by the client’s center. The system is capable enough to handle student records, Credential’s records, member’s records, visitors records, report generation, and storing other related information.

2. Overall Description 2.1 Product Perspectives: The proposed system falls under RDBMS (Relational Data Base Management System) category. I have adopted PHP as front end for the software and MYSQL as back end. PHP is at present one of the most popular development platform for web based system that is efficient for web programming. MYSQL is at present the most reliable and secure RDBMS tool. MYSQL Server works to efficiently manage its resource, a database of information, among the multiple clients requesting and sending data in the network. MYSQL has many important features that make it not only an exceptional database management system but also an excellent database server choice for client/server database computing. So the overall system will prove to reliable, secure and efficient for the organization. 2.2

Product Functions

Functionalities: 2.2.1 Any person can query for Credentials availability according to specified conditions. 2.2.3 A Person can Credential/cancel the Credential only after he logs in. 2.2.4 2.2.4 A user can sign up for a profile if he doesn’t have one already. 2.2.5 On logging in, the user has options to 1. Credential issued . 2. Edit Profile information

3. Cancellation of his Credentialed issued. 4. View all current Credentials Credentialed by him. 5. Logout 2.2.6 A person can get all information regarding a student if he keys in it. 

A person can get all information about a Credentials if he keys in the Credential id.



A person can get the availability of all Credentials for the next 20 days.



Official members are suppose to do that work which distributed by the administrator



Administrator or assigned official members can add/modify/delete student information.



Administrator or assigned official members can add/modify/delete seat type according their availability and generate report.



Administrator or assigned official members can add/modify/delete student information.



Administrator or assigned official members can define and manage charges information.



Administrator or assigned official members can define scheme and modify time to time and generate report.



Administrator can add/modify/delete official member and generate report.



Administrator can add/modify/delete user information and generate report.

2.3. Operating Environment – The proposed software is to run on client/server model network. A client/server can deliver the better performance than the file server system because a client application and database server work together to split processing load of applications (thus the term distributed processing). The server manages the database among the number of clients, while the client send, request, and analyze the data entry form with small specific data set, such as rows in a table not file as in the file server system. A database server is intelligent enough so that it lock and return only the rows a client request, which ensure concurrency, minimize the network traffic and increase the system performance. 2.4.

Assumptions and Dependencies – While cost estimation of the proposed system it has been assumed that the cost hardware and for license of Operating System and back end will be met by client (the organization). Hence only the cost incurred for the proposed software is included therein. The followings are identified as some of the potential risk factors or dependencies: (1)

Non-availability of required resources.

(2)

Power cuts.

(3)

Slippage of schedule due to unpredictable holidays, etc.

2.5 Life Cycle Model – I am using SDLC model that begin at system level and progresses through analysis, design, coding, testing, implementation and maintenance. 3.

External Interface Requirements

3.1

User Interfaces – It has been required that every form’s interface

should be user friendly and simple to use. Besides, there should be facility of accessing the system through keyboard along with the mouse i.e. 3.2

keyboard shortcuts.

Software Interfaces – It has been required that there could be a

necessity of using the stored data for some kind of report that is not supported by proposed system at present. So the proposed system is required to export its data as text file so that some other application software can import the data. 4.

System Future Requirement – Other than descriptions provided above,

the following features were required by the client: (1)

The system should be secured enough to rely upon.

(2)

Users should not be allowed to delete/modify any records.

(3)

Users should not be allowed to take financial reports.

(4)

Every users report should keep the tracks of user inputting the record.

(5)

System should provide facility of exporting its data in text format.

(6)

System should be able to integrate with its Phase II developments.

5. Other Nonfunctional Requirements a. Performance Requirements – As it is going to be used by all the concerned employees within the organization, the system should have a good performance in terms of speed and accuracy. The proposed system should be accurate and fast enough to handle huge data. It should provide fast communication between server and clients. b. Safety Requirements – As the system is going to handle records for a long run eliminating the manual system, it is supposed to ensure the retaining of data avoiding or eliminating any probable cause for data loss. c. Security

Requirements



The

software

should

not

allow

unauthorized access to any module of the system. Besides, it should maintain the privileges granted to users at various user levels. d. Software Quality Attributes – The prioritization of the software quality attributes are assumed as under: (1)

Accurate and hence reliable.

(2)

Secured.

(3)

Fast speed.

(4)

Compatibility.

(5)

Portability.

Tools/Platform, Hardware and Software Requirement specifications: For setting this portal, it requires certain technical requirements to be met for the store to operate properly. First, a web server must be created to make the portal publicly available on the web. Domain names and hosting services can easily be purchased for an affordable price. When selecting a hosting service, you should check to see that these server requirements are provided and installed on their web servers: Software Details for running Online Career Guidence Portal    

Web Server (preferably Tomcat Apache) JSP (at least 5.2) MySQL Curl

Required JSP libraries / modules      

Curl ZIP Zlib GD Library Mcrypt Mbstrings

The above JSP extensions should be available by almost all hosting providers, during the install processa it will check you have them all enabled. You should contact your hosting provider if one is missing.

Hardware Requirements Name of component Processor RAM Hard disk Monitor Keyboard

Specification Pentium III 630MHz 128 MB 20 GB 15” color monitor 122 keys

Software Configuration Name of component Operating System Language Database

Specification Windows 98, Windows XP, Windows7 Java 2 Runtime Environment Mysql server

System Requirements This management system can be used in windows 98, Windows2000, Windows XP and Windows 7, supported for other platform such as Applet, Macintosh and UNIX. The system must be running Windows 98, Windows 98 or Windows NT4.0 operating system and must meet the following hardware requirements. 

For Windows 95 based computers , a 486 / 66 MHz or higher processor with 8MB



For Windows 98 based computers , a 500/88MHz or higher processor with 32 Mb of RAM



For Windows NT based computers , a 488 / 66 MHz or higher processor with 16 MB of RAM



For Windows 200 based computers , a 700/850 MHz or higher processor with 512 MB of Ram

Database Design The general theme behind a database is to handle information as an integrated whole. A database is a collection of interrelated data stored with minimum redundancy to serve many users quickly and effectively. After designing input and output, the analyst must concentrate on database

design

or

how

data

should

be

organized

around

user

requirements. The general objective is to make information access, easy quick, inexpensive and flexible for other users. During database design the following objectives are concerned: Controlled Redundancy  Data independence  Accurate and integrating  More information at low cost  Recovery from failure  Privacy and security  Performance  Ease of learning and use

System Implementation Implementation is the stage in the project where the theoretical design is turned into a working system. The implementation phase constructs, installs and operates the new system. The most crucial stage in achieving a new successful system is that it will work efficiently and effectively. There are several activities involved while implementing a new project.They are:  End user training  End user Education  Training on the application software  System Design  Parallel Run and To New System  Post implementation Review End user Training: The successful implementation of the new system will purely upon the involvement of the officers working in that department. The officers will be imparted the necessary training on the new technology End User Education: The education of the end user start after the implementation and testing is over. When the system is found to be more difficult to understand and complex, more effort is put to educate the end used to make them aware of the system, giving them lectures about the new system and providing them necessary documents and materials about how the system can do this. Training of application software:

After providing the necessary basic training on the computer awareness, the users will have to be trained upon the new system such as the screen flows and screen design type of help on the screen, type of errors while entering the data, the corresponding validation check at each entry and the way to correct the data entered. It should then cover information needed by the specific user or group to use the system. Post Implementation View: The department is planning a method to know the states of t he past implementation process. For that regular meeting will be arranged by the concerned officers about the implementation problem and success.

Code of Connect.java package com; import java.sql.*; import java.util.*; import java.io.*; public class Connect { public static Statement statement = null; public static Connection connection; public static ResultSet rs; public static PreparedStatement pstmt; /////Function for connect to the MySQL Server Database//////////// public static void connect_mysql() { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection("jdbc:mysql://localhost/online_news_portal?" + "user=root"); statement=connection.createStatement(); } catch(Exception e) { System.out.println(" Error : "+ e.toString()); } } ////////Function for geting the Option/////////////////////

public static String getOptionList(String tableName,String idColumn,String valueColumn,String Columns,int selID,String conn) { String SQL = "SELECT "+Columns+" FROM "+tableName+" where "+conn; String Option="Please Select"; try { rs = statement.executeQuery(SQL); while(rs.next()) { int selectedID = rs.getInt(idColumn); if(selectedID==selID) Option+=""+rs.getString(valueColumn)+""; else Option+=""+rs.getString(valueColumn)+""; } } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); Option+="Error : "+stackTrace; System.out.println("Error : "+e);

} return Option; } }

Code of UploadNews.java import java.io.File; import java.io.IOException; import Model.*; import java.util.*; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; @WebServlet("/UploadNews") @MultipartConfig(fileSizeThreshold=1024*1024*2, // 2MB maxFileSize=1024*1024*10,

// 10MB

maxRequestSize=1024*1024*50)

// 50MB

public class UploadNews extends HttpServlet { private static final String SAVE_DIR = "newsImages"; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //// Logic for Upload the File //// String appPath = request.getServletContext().getRealPath(""); String savePath = appPath + File.separator + SAVE_DIR; File fileSaveDir = new File(savePath); if (!fileSaveDir.exists()) { fileSaveDir.mkdir();

} long unixTime = System.currentTimeMillis() / 1000L; Part part; part = request.getPart("news_image"); String fileName = extractFileName(part); if(!fileName.equals("")) { fileName = unixTime+"_"+extractFileName(part); part.write(savePath + File.separator + fileName); } else { fileName = request.getParameter("image_name"); } //// Upload File Complete/// /////Save the News Details ///// News newsObj = new News(); String emp_id = "0"; if((request.getParameter("act")).equals("Save")) { HashMap results = new HashMap();

results.put("news_title",request.getParameter("news_title")); results.put("news_type_id",request.getParameter("news_type_id"));

results.put("news_description",request.getParameter("news_description")); results.put("news_id",request.getParameter("news_id")); results.put("news_image",fileName);

if((request.getParameter("news_id")).equals("")) { newsObj.saveNews(results); request.setAttribute("message", "News Saved Successfully !!!!"); getServletContext().getRequestDispatcher("/reportnews.jsp").forward(request, response); } else { results.put("news_id",request.getParameter("news_id")); newsObj.updateNews(results); request.setAttribute("message", "News Updated Successfully !!!!"); getServletContext().getRequestDispatcher("/reportnews.jsp").forward(request, response); } } } /** * Extracts file name from HTTP header content-disposition */ private String extractFileName(Part part) { String contentDisp = part.getHeader("content-disposition"); String[] items = contentDisp.split(";"); for (String s : items) { if (s.trim().startsWith("filename")) {

return s.substring(s.indexOf("=") + 2, s.length()-1); } } return ""; } }

Code of Comments.java package Model; import java.util.*; import java.sql.*; import com.*; import java.io.*; public class Comments extends Connect { /////Function for connect to the MySQL Server Database//////////// public Comments() { Connect.connect_mysql(); } //////////Save User Details ///// public String saveComments(HashMap ticketData) { String SQL = "INSERT INTO `comments` (`comment_news_id`, `comment_name`, `comment_email`, `comment_description`) VALUES (?, ?, ?, ?);"; int record=0; String error = ""; try { pstmt = connection.prepareStatement(SQL); pstmt.setString(1,(String) ticketData.get("comment_news_id"));

pstmt.setString(2,(String) ticketData.get("comment_name")); pstmt.setString(3,(String) ticketData.get("comment_email")); pstmt.setString(4,(String) ticketData.get("comment_description")); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace; System.out.println(" Error : "+ e.toString()); } return error; } ////////////////Function for getting all the Airport Details//////////////////// public ArrayList getAllComments(String news_id) {

String SQL = "SELECT * FROM `comments` WHERE comment_news_id = "+news_id+" ORDER BY comment_id ASC"; int count=0; ArrayList resultArray = new ArrayList(); try { statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { HashMap results = new HashMap();

results.put("comment_description",rs.getString("comment_description")); results.put("comment_name",rs.getString("comment_name")); results.put("comment_email",rs.getString("comment_email")); count++; resultArray.add(results); } } catch(Exception e) { System.out.println("Error is: "+ e); } return resultArray; } }

Code of Customer.java package Model; import java.util.*; import java.sql.*; import com.*; import java.io.*; public class Customer extends Connect { /////Function for connect to the MySQL Server Database//////////// public Customer() { Connect.connect_mysql(); } //////////Save User Details ///// public String saveCustomer(HashMap customerData) { String SQL = "INSERT INTO `customer` (`customer_name`, `customer_mobile`, `customer_email`, `customer_password`, `customer_address`, `customer_city`, `customer_state`, `customer_pincode`) VALUES (?, ?, ?, ?, ?, ?, ?, ?);"; int record=0; String error = ""; try { pstmt = connection.prepareStatement(SQL);

pstmt.setString(1,(String) customerData.get("customer_name")); pstmt.setString(2,(String) customerData.get("customer_mobile")); pstmt.setString(3,(String) customerData.get("customer_email")); pstmt.setString(4,(String) customerData.get("customer_password")); pstmt.setString(5,(String) customerData.get("customer_address")); pstmt.setString(6,(String) customerData.get("customer_city")); pstmt.setString(7,(String) customerData.get("customer_state")); pstmt.setString(8,(String) customerData.get("customer_pincode")); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace;

System.out.println(" Error : "+ e.toString()); } return error; } //////////////////Function for getting Users Details////////// public HashMap getCustomerDetails(int customer_id) { HashMap results = new HashMap(); int count=0; try { String SQL = "SELECT * FROM `customer` WHERE customer_id = "+customer_id ; statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { results.put("customer_name",rs.getString("customer_name")); results.put("customer_mobile",rs.getString("customer_mobile")); results.put("customer_email",rs.getString("customer_email")); results.put("customer_password",rs.getString("customer_password")); results.put("customer_address",rs.getString("customer_address")); results.put("customer_city",rs.getString("customer_city"));

results.put("customer_state",Integer.parseInt(rs.getString("customer_state" ))); results.put("customer_pincode",rs.getString("customer_pincode")); results.put("customer_id",rs.getString("customer_id")); count++; } if(count==0) { results.put("customer_name",""); results.put("customer_mobile",""); results.put("customer_email",""); results.put("customer_password",""); results.put("customer_address",""); results.put("customer_city",""); results.put("customer_state",0); results.put("customer_pincode",""); results.put("customer_id",""); } } catch(Exception e) { System.out.println("Error is: "+ e); } return results; } /// Update the Customer ////

public String updateCustomer(HashMap customerData) { String SQL = "UPDATE `customer` SET `customer_name` = ?, `customer_mobile` = ?, `customer_email` = ?, `customer_password` = ?, `customer_address` = ?, `customer_city` = ?, `customer_state` = ?, `customer_pincode` = ? WHERE `customer_id` = ?;"; String error = ""; int record=0; try { pstmt = connection.prepareStatement(SQL); pstmt.setString(1,(String) customerData.get("customer_name")); pstmt.setString(2,(String) customerData.get("customer_mobile")); pstmt.setString(3,(String) customerData.get("customer_email")); pstmt.setString(4,(String) customerData.get("customer_password")); pstmt.setString(5,(String) customerData.get("customer_address")); pstmt.setString(6,(String) customerData.get("customer_city")); pstmt.setString(7,(String) customerData.get("customer_state")); pstmt.setString(8,(String) customerData.get("customer_pincode"));

pstmt.setString(9,(String) customerData.get("customer_id")); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace; System.out.println(" Error : "+ e.toString()); } return error; } ////////////////Function for getting all the Airport Details//////////////////// public ArrayList getAllCustomer() { String SQL = "SELECT * FROM `customer`"; int count=0; ArrayList resultArray = new ArrayList(); try { statement = connection.createStatement();

rs = statement.executeQuery(SQL); while(rs.next()) { HashMap results = new HashMap(); results.put("customer_name",rs.getString("customer_name")); results.put("customer_mobile",rs.getString("customer_mobile")); results.put("customer_email",rs.getString("customer_email")); results.put("customer_password",rs.getString("customer_password")); results.put("customer_address",rs.getString("customer_address")); results.put("customer_city",rs.getString("customer_city"));

results.put("customer_state",Integer.parseInt(rs.getString("customer_state" ))); results.put("customer_pincode",rs.getString("customer_pincode")); results.put("customer_id",rs.getString("customer_id")); count++; resultArray.add(results); } } catch(Exception e) {

System.out.println("Error is: "+ e); } return resultArray; } /////Function for Getting the List//////////// public String getStateOption(Integer SelID) { int selectedID = SelID.intValue(); return Connect.getOptionList("state","state_id","state_name","state_id,state_name ",selectedID,"1"); } //////////////////Function for getting Login Details////////// public HashMap getLoginDetails(String login_user,String login_password) { HashMap resultsArray = new HashMap(); int count=0; try { String SQL = "SELECT * FROM customer WHERE customer_email = '"+login_user+"' AND customer_password = '"+login_password+"'" ; statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { resultsArray.put("customer_id",rs.getString("customer_id")); resultsArray.put("customer_name",rs.getString("customer_name"));

resultsArray.put("login_level",4); count++; } if(count==0) { resultsArray.put("customer_id",""); resultsArray.put("customer_name",""); resultsArray.put("login_level",0); } } catch(Exception e) { System.out.println("Error is: "+ e); } return resultsArray; } //////////////////Function for checking the existing username////////// public int checkUsernameExits(String login_user, int type) { HashMap resultsArray = new HashMap(); int exits=0; try { String SQL = ""; if(type == 1) { SQL = "SELECT * FROM customer WHERE customer_email = '"+login_user+"'" ; } statement = connection.createStatement();

rs = statement.executeQuery(SQL); while(rs.next()) { exits++; } } catch(Exception e) { System.out.println("Error is: "+ e); } return exits; } //////////////////Function for geting the Single Airport Details////////// public boolean checkLogin(String login_user,String login_password) { int count=0; try { String SQL = "SELECT * FROM customer WHERE customer_email = '"+login_user+"' AND customer_password = '"+login_password+"'" ; statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next())

count++;

} catch(Exception e) { System.out.println("Error is: "+ e); } if(count==0)

return false; return true; } }

Code of Employee.java package Model; import java.util.*; import java.sql.*; import com.*; import java.io.*; public class Employee extends Connect { /////Function for connect to the MySQL Server Database//////////// public Employee() { Connect.connect_mysql(); } //////////Save User Details ///// public String saveEmployee(HashMap employeeData) { String SQL = "INSERT INTO employee (employee_sal, employee_first_name, employee_middle_name, employee_last_name, employee_gender, employee_address, employee_village, employee_state, employee_country, employee_landline, employee_mobile, employee_email, employee_status, employee_deparment, employee_dob, employee_nationalty, employee_manager_id, employee_role) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"; int record=0,last_inserted_id=0; String error = "";

try { pstmt = connection.prepareStatement(SQL, Statement.RETURN_GENERATED_KEYS); pstmt.setString(1,(String) employeeData.get("employee_sal")); pstmt.setString(2,(String) employeeData.get("employee_first_name")); pstmt.setString(3,(String) employeeData.get("employee_middle_name")); pstmt.setString(4,(String) employeeData.get("employee_last_name")); pstmt.setString(5,(String) employeeData.get("employee_gender")); pstmt.setString(6,(String) employeeData.get("employee_address")); pstmt.setString(7,(String) employeeData.get("employee_village")); pstmt.setString(8,(String) employeeData.get("employee_state")); pstmt.setString(9,(String) employeeData.get("employee_country")); pstmt.setString(10,(String) employeeData.get("employee_landline")); pstmt.setString(11,(String) employeeData.get("employee_mobile")); pstmt.setString(12,(String) employeeData.get("employee_email")); pstmt.setString(13,(String) employeeData.get("employee_status"));

pstmt.setString(14,(String) employeeData.get("employee_deparment")); pstmt.setString(15,(String) employeeData.get("employee_dob")); pstmt.setString(16,(String) employeeData.get("employee_nationalty")); pstmt.setString(17,(String) employeeData.get("employee_manager_id")); pstmt.setString(18,(String) employeeData.get("employee_role")); record = pstmt.executeUpdate(); /// Get the Last Insert ID /// rs = pstmt.getGeneratedKeys(); if(rs.next()) { last_inserted_id = rs.getInt(1); } pstmt.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace;

System.out.println(" Error : "+ e.toString()); } /// Save Credentials to Login //// SQL = "INSERT INTO login (login_emp_id, login_user, login_password, login_email, login_level) VALUES (?, ?, ?, ?, ?);"; try { pstmt = connection.prepareStatement(SQL); pstmt.setInt(1,last_inserted_id); pstmt.setString(2,(String) employeeData.get("employee_user")); pstmt.setString(3,(String) employeeData.get("employee_password")); pstmt.setString(4,(String) employeeData.get("employee_email")); pstmt.setString(5,(String) employeeData.get("employee_role")); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace;

System.out.println(" Error : "+ e.toString()); } return error; } //////////////////Function for getting Users Details////////// public HashMap getEmployeeDetails(int employee_id) { HashMap resultsArray = new HashMap(); int count=0; try { String SQL = "SELECT * FROM employee WHERE employee_id = "+employee_id ; statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { resultsArray.put("employee_id",rs.getString("employee_id"));

resultsArray.put("employee_manager_id",Integer.parseInt(rs.getString("emp loyee_manager_id")));

resultsArray.put("employee_role",Integer.parseInt(rs.getString("employee_r ole")));

resultsArray.put("employee_sal",Integer.parseInt(rs.getString("employee_sal ")));

resultsArray.put("employee_first_name",rs.getString("employee_first_name" ));

resultsArray.put("employee_middle_name",rs.getString("employee_middle_n ame"));

resultsArray.put("employee_last_name",rs.getString("employee_last_name") );

resultsArray.put("employee_gender",rs.getString("employee_gender"));

resultsArray.put("employee_address",rs.getString("employee_address")); resultsArray.put("employee_village",rs.getString("employee_village"));

resultsArray.put("employee_state",Integer.parseInt(rs.getString("employee_ state")));

resultsArray.put("employee_country",Integer.parseInt(rs.getString("employe e_country")));

resultsArray.put("employee_landline",rs.getString("employee_landline"));

resultsArray.put("employee_mobile",rs.getString("employee_mobile")); resultsArray.put("employee_email",rs.getString("employee_email"));

resultsArray.put("employee_status",Integer.parseInt(rs.getString("employee _status")));

resultsArray.put("employee_deparment",Integer.parseInt(rs.getString("empl oyee_deparment"))); resultsArray.put("employee_dob",rs.getString("employee_dob"));

resultsArray.put("employee_nationalty",rs.getString("employee_nationalty")) ; count++; } if(count==0) { resultsArray.put("employee_id",""); resultsArray.put("employee_manager_id",0); resultsArray.put("employee_role",0); resultsArray.put("employee_user",""); resultsArray.put("employee_sal",0); resultsArray.put("employee_first_name","");

resultsArray.put("employee_middle_name",""); resultsArray.put("employee_last_name",""); resultsArray.put("employee_gender",""); resultsArray.put("employee_address",""); resultsArray.put("employee_village",""); resultsArray.put("employee_state",0); resultsArray.put("employee_country",0); resultsArray.put("employee_landline",""); resultsArray.put("employee_mobile",""); resultsArray.put("employee_email",""); resultsArray.put("employee_status",0); resultsArray.put("employee_deparment",0); resultsArray.put("employee_dob",""); resultsArray.put("employee_nationalty",""); } } catch(Exception e) { System.out.println("Error is: "+ e); } return resultsArray; } public String updateEmployee(HashMap employeeData) { String SQL = "UPDATE employee SET employee_sal = ?, employee_first_name = ?, employee_middle_name = ?, employee_last_name = ?, employee_gender = ?, employee_address = ?,

employee_village = ?, employee_state = ?, employee_country = ?, employee_landline = ?, employee_mobile = ?, employee_email = ?, employee_status = ?, employee_deparment = ?, employee_dob = ?, employee_nationalty = ?, employee_manager_id = ?, employee_role = ? WHERE employee_id = ?"; String error = ""; int record=0; try { pstmt = connection.prepareStatement(SQL); pstmt.setString(1,(String) employeeData.get("employee_sal")); pstmt.setString(2,(String) employeeData.get("employee_first_name")); pstmt.setString(3,(String) employeeData.get("employee_middle_name")); pstmt.setString(4,(String) employeeData.get("employee_last_name")); pstmt.setString(5,(String) employeeData.get("employee_gender")); pstmt.setString(6,(String) employeeData.get("employee_address")); pstmt.setString(7,(String) employeeData.get("employee_village")); pstmt.setString(8,(String) employeeData.get("employee_state")); pstmt.setString(9,(String) employeeData.get("employee_country"));

pstmt.setString(10,(String) employeeData.get("employee_landline")); pstmt.setString(11,(String) employeeData.get("employee_mobile")); pstmt.setString(12,(String) employeeData.get("employee_email")); pstmt.setString(13,(String) employeeData.get("employee_status")); pstmt.setString(14,(String) employeeData.get("employee_deparment")); pstmt.setString(15,(String) employeeData.get("employee_dob")); pstmt.setString(16,(String) employeeData.get("employee_nationalty")); pstmt.setString(17,(String) employeeData.get("employee_manager_id")); pstmt.setString(18,(String) employeeData.get("employee_role")); pstmt.setString(19,(String) employeeData.get("employee_id")); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter );

printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace; System.out.println(" Error : "+ e.toString()); } return error; } public boolean deleteEmployee(int employee_id) { return true; } /////Function for Getting the List//////////// public String getStateOption(Integer SelID) { int selectedID = SelID.intValue(); return Connect.getOptionList("state","state_id","state_name","state_id,state_name ",selectedID,"1"); } /////Function for Getting the List//////////// public String getEmployeeOption(Integer SelID) { int selectedID = SelID.intValue(); return Connect.getOptionList("employee","employee_id","employee_id","employee_ id,employee_id",selectedID,"1"); } /////Function for Getting the List////////////

public String getRoleOption(Integer SelID) { int selectedID = SelID.intValue(); return Connect.getOptionList("roles","role_id","role_title","role_id,role_title",selecte dID,"1"); } /////Function for Getting the List//////////// public String getCountryOption(Integer SelID) { int selectedID = SelID.intValue(); return Connect.getOptionList("country","country_id","country_name","country_id,c ountry_name",selectedID,"1"); } /////Function for Getting the List//////////// public String getSalutionOption(Integer SelID) { int selectedID = SelID.intValue(); return Connect.getOptionList("salutions","sl_id","sl_name","sl_id,sl_name",selected ID,"1"); } /////Function for Getting the List//////////// public String getStatusOption(Integer SelID) { int selectedID = SelID.intValue();

return Connect.getOptionList("status","status_id","status_name","status_id,status_ name",selectedID,"1"); } /////Function for Getting the List//////////// public String getDepartmentOption(Integer SelID) { int selectedID = SelID.intValue(); return Connect.getOptionList("department","dept_id","dept_name","dept_id,dept_n ame",selectedID,"1"); } ////////////////Function for getting all the Airport Details//////////////////// public ArrayList getAllEmployee(String managerID) { int count=0; String error = ""; String SQL = "SELECT * FROM employee"; ArrayList resultArray = new ArrayList(); try { if(!managerID.equals("0")) { SQL = "SELECT * FROM employee WHERE employee_manager_id = "+managerID; }

statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { HashMap results = new HashMap(); results.put("employee_id",rs.getString("employee_id")); results.put("employee_role",rs.getString("employee_role")); results.put("employee_sal",rs.getString("employee_sal"));

results.put("employee_first_name",rs.getString("employee_first_name"));

results.put("employee_middle_name",rs.getString("employee_middle_name" ));

results.put("employee_last_name",rs.getString("employee_last_name")); results.put("employee_gender",rs.getString("employee_gender")); results.put("employee_address",rs.getString("employee_address")); results.put("employee_village",rs.getString("employee_village")); results.put("employee_state",rs.getString("employee_state")); results.put("employee_country",rs.getString("employee_country"));

results.put("employee_landline",rs.getString("employee_landline")); results.put("employee_mobile",rs.getString("employee_mobile")); results.put("employee_email",rs.getString("employee_email"));

results.put("employee_status",Integer.parseInt(rs.getString("employee_stat us")));

results.put("employee_deparment",Integer.parseInt(rs.getString("employee_ deparment"))); results.put("employee_dob",rs.getString("employee_dob"));

results.put("employee_nationalty",rs.getString("employee_nationalty"));

results.put("employee_manager_id",Integer.parseInt(rs.getString("employee _manager_id"))); count++; resultArray.add(results); } } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer );

e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace; System.out.println(" Error : "+ e.toString()); } return resultArray; } public String getDepartment(int dept_id) { HashMap results = new HashMap(); String SQL = ""; String value = ""; int count=0; try { SQL = "SELECT dept_name FROM department WHERE dept_id = "+dept_id ; statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { value = rs.getString("dept_name"); } } catch(Exception e) { System.out.println("Error is: "+ e);

} return value; } public String getStatus(int status_id) { HashMap results = new HashMap(); String SQL = ""; String value = ""; int count=0; try { SQL = "SELECT status_name FROM status WHERE status_id = "+status_id ; statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { value = rs.getString("status_name"); } } catch(Exception e) { System.out.println("Error is: "+ e); } return value; } }

Code of Login.java package Model; import java.util.*; import java.sql.*; import com.*; import java.io.*; public class Login extends Connect { /////Function for connect to the MySQL Server Database//////////// public Login() { Connect.connect_mysql(); } //////////////////Function for Update the airport//////////////////////// public boolean changePassword(String old_password,String new_password, int login_id) { String SQL; int count = 0; try { SQL = "SELECT * FROM login WHERE login_password = '"+old_password+"' AND login_id = "+login_id ; statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next())

count++;

if(count==1)

{ SQL = "UPDATE login SET login_password=? WHERE login_id=?"; int record=0; pstmt = connection.prepareStatement(SQL); pstmt.setString(1,new_password); pstmt.setInt(2,login_id); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } } catch(Exception e) { System.out.println(" Error : "+ e.toString()); } if(count==0) return false; return true; } //////////////////Function for geting the Single Airport Details////////// public boolean checkLogin(String login_user,String login_password) { int count=0; try { String SQL = "SELECT * FROM login WHERE login_user = '"+login_user+"' AND login_password = '"+login_password+"'" ; statement = connection.createStatement();

rs = statement.executeQuery(SQL); while(rs.next())

count++;

} catch(Exception e) { System.out.println("Error is: "+ e); } if(count==0) return false; return true; } //////////////////Function for getting Login Details////////// public HashMap getLoginDetails(String login_user,String login_password) { HashMap resultsArray = new HashMap(); int count=0; try { String SQL = "SELECT * FROM login WHERE login_user = '"+login_user+"' AND login_password = '"+login_password+"'" ; statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { resultsArray.put("login_id",rs.getString("login_id")); resultsArray.put("login_emp_id",rs.getString("login_emp_id")); resultsArray.put("login_user",rs.getString("login_user"));

resultsArray.put("login_level",rs.getString("login_level")); count++; } if(count==0) { resultsArray.put("login_id",""); resultsArray.put("login_emp_id",""); resultsArray.put("login_user",""); resultsArray.put("login_level",""); } } catch(Exception e) { System.out.println("Error is: "+ e); } return resultsArray; } //////////////////Function for getting Login Details////////// public int checkUsernameExits(String login_user, int type) { HashMap resultsArray = new HashMap(); int exits=0; try { String SQL = ""; if(type == 1) { SQL = "SELECT * FROM login WHERE login_user = '"+login_user+"'" ;

} if(type == 2) { SQL = "SELECT * FROM login WHERE login_email = '"+login_user+"'" ; } statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { exits++; } } catch(Exception e) { System.out.println("Error is: "+ e); } return exits; } }

Code of News.java package Model; import java.util.*; import java.sql.*; import com.*; import java.io.*; public class News extends Connect { /////Function for connect to the MySQL Server Database//////////// public News() { Connect.connect_mysql(); } //////////Save User Details ///// public String saveNews(HashMap newsData) { String SQL = "INSERT INTO `news` (`news_title`, `news_type_id`, `news_image`, `news_description`) VALUES (?, ?, ?, ?);"; int record=0; String error = ""; try { pstmt = connection.prepareStatement(SQL); pstmt.setString(1,(String) newsData.get("news_title")); pstmt.setString(2,(String) newsData.get("news_type_id"));

pstmt.setString(3,(String) newsData.get("news_image")); pstmt.setString(4,(String) newsData.get("news_description")); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace; System.out.println(" Error : "+ e.toString()); } return error; } //////////////////Function for getting Users Details////////// public HashMap getNewsDetails(int news_id) { HashMap results = new HashMap(); int count=0; try { String SQL = "SELECT * FROM `news`,`type` WHERE news_type_id = type_id AND news_id = "+news_id ;

statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { results.put("news_title",rs.getString("news_title"));

results.put("news_type_id",Integer.parseInt(rs.getString("news_type_id"))); results.put("news_description",rs.getString("news_description")); results.put("news_id",rs.getString("news_id")); results.put("news_image",rs.getString("news_image")); results.put("news_type",rs.getString("type_name")); count++; } if(count==0) { results.put("news_title",""); results.put("news_type_id",0); results.put("news_description",""); results.put("news_image",""); results.put("news_id",""); } } catch(Exception e) { System.out.println("Error is: "+ e); }

return results; } /// Update the News //// public String updateNews(HashMap newsData) { String SQL = "UPDATE `news` SET `news_title` = ?, `news_type_id` = ?, `news_image` = ?, `news_description` = ? WHERE `news_id` = ?;"; String error = ""; int record=0; try { pstmt = connection.prepareStatement(SQL); pstmt.setString(1,(String) newsData.get("news_title")); pstmt.setString(2,(String) newsData.get("news_type_id")); pstmt.setString(3,(String) newsData.get("news_image")); pstmt.setString(4,(String) newsData.get("news_description")); pstmt.setString(5,(String) newsData.get("news_id")); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter();

PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace; System.out.println(" Error : "+ e.toString()); } return error; } ////////////////Function for getting all the Airport Details//////////////////// public ArrayList getAllNews(int typeID) { int count=0; String SQL = ""; if(typeID != 0) SQL = "SELECT * FROM `news`,`type` WHERE news_type_id = type_id AND type_id = "+typeID; else SQL = "SELECT * FROM `news`, `type` WHERE news_type_id = type_id"; ArrayList resultArray = new ArrayList(); try { statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) {

HashMap results = new HashMap(); results.put("news_title",rs.getString("news_title"));

results.put("news_type_id",Integer.parseInt(rs.getString("news_type_id"))); results.put("news_description",rs.getString("news_description")); results.put("news_id",rs.getString("news_id")); results.put("news_image",rs.getString("news_image")); results.put("news_type",rs.getString("type_name")); count++; resultArray.add(results); } } catch(Exception e) { System.out.println("Error is: "+ e); } return resultArray; } /////Function for Getting the List//////////// public String getTypeOption(Integer SelID) { int selectedID = SelID.intValue(); return Connect.getOptionList("type","type_id","type_name","type_id,type_name",s electedID,"1"); }

}

Code of News Type.java package Model; import java.util.*; import java.sql.*; import com.*; import java.io.*; public class Type extends Connect { /////Function for connect to the MySQL Server Database//////////// public Type() { Connect.connect_mysql(); } //////////Save User Details ///// public String saveType(HashMap typeData) { String SQL = "INSERT INTO type (type_name, type_description, type_show) VALUES (?, ?, ?);"; int record=0; String error = ""; try { pstmt = connection.prepareStatement(SQL); pstmt.setString(1,(String) typeData.get("type_name")); pstmt.setString(2,(String) typeData.get("type_description"));

pstmt.setString(3,(String) typeData.get("type_show")); record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace; System.out.println(" Error : "+ e.toString()); } return error; } //////////////////Function for getting Users Details////////// public HashMap getTypeDetails(int type_id) { HashMap results = new HashMap(); int count=0; try { String SQL = "SELECT * FROM `type` WHERE type_id = "+type_id ; statement = connection.createStatement(); rs = statement.executeQuery(SQL);

while(rs.next()) { results.put("type_name",rs.getString("type_name")); results.put("type_description",rs.getString("type_description")); results.put("type_show",rs.getString("type_show")); results.put("type_id",rs.getString("type_id")); count++; } if(count==0) { results.put("type_name",""); results.put("type_description",""); results.put("type_show",""); results.put("type_id",""); } } catch(Exception e) { System.out.println("Error is: "+ e); } return results; } /// Update the Type //// public String updateType(HashMap typeData) { String SQL = "UPDATE type SET type_name = ?, type_description = ?, type_show = ? WHERE type_id = ?;";

String error = ""; int record=0; try { pstmt = connection.prepareStatement(SQL); pstmt.setString(1,(String) typeData.get("type_name")); pstmt.setString(2,(String) typeData.get("type_description")); pstmt.setString(3,(String) typeData.get("type_show")); pstmt.setString(4,(String) typeData.get("type_id"));

record = pstmt.executeUpdate(); pstmt.close(); connection.close(); } catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter( writer ); e.printStackTrace( printWriter ); printWriter.flush(); String stackTrace = writer.toString(); error+="Error : "+stackTrace; System.out.println(" Error : "+ e.toString()); } return error;

} ////////////////Function for getting all the Airport Details//////////////////// public ArrayList getAllType(int type_id) { String SQL = "SELECT * FROM `type`" ; int count=0; ArrayList resultArray = new ArrayList(); try { statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { HashMap results = new HashMap(); results.put("type_name",rs.getString("type_name")); results.put("type_description",rs.getString("type_description")); results.put("type_show",rs.getString("type_show")); results.put("type_id",rs.getString("type_id")); count++; resultArray.add(results); } } catch(Exception e) { System.out.println("Error is: "+ e);

} return resultArray; } ////////////////Function for getting all the Airport Details//////////////////// public ArrayList getMenu(int type_id) { String SQL = "SELECT * FROM `type` WHERE type_show = '1'" ; int count=0; ArrayList resultArray = new ArrayList(); try { statement = connection.createStatement(); rs = statement.executeQuery(SQL); while(rs.next()) { HashMap results = new HashMap(); results.put("type_name",rs.getString("type_name")); results.put("type_description",rs.getString("type_description")); results.put("type_show",rs.getString("type_show")); results.put("type_id",rs.getString("type_id")); count++; resultArray.add(results); } } catch(Exception e)

{ System.out.println("Error is: "+ e); } return resultArray; } }

Code of UploadImage.java import java.io.File; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; @WebServlet("/UploadFile") @MultipartConfig(fileSizeThreshold=1024*1024*2, // 2MB maxFileSize=1024*1024*10,

// 10MB

maxRequestSize=1024*1024*50)

// 50MB

public class UploadFile extends HttpServlet { /** * Name of the directory where uploaded files will be saved, relative to * the web application directory. */ private static final String SAVE_DIR = "uploadFiles"; /** * handles file upload */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

// gets absolute path of the web application String appPath = request.getServletContext().getRealPath(""); // constructs path of the directory to save uploaded file String savePath = appPath + File.separator + SAVE_DIR; // creates the save directory if it does not exists File fileSaveDir = new File(savePath); if (!fileSaveDir.exists()) { fileSaveDir.mkdir(); } for (Part part : request.getParts()) { String fileName = extractFileName(part); // out.println(fileName); fileName = "kaushal"; part.write(savePath + File.separator + fileName); } request.setAttribute("message", "Upload has been done successfully!"); getServletContext().getRequestDispatcher("/message.jsp").forward( request, response); } /** * Extracts file name from HTTP header content-disposition */ private String extractFileName(Part part) { String contentDisp = part.getHeader("content-disposition"); String[] items = contentDisp.split(";"); for (String s : items) {

if (s.trim().startsWith("filename")) { return s.substring(s.indexOf("=") + 2, s.length()-1); } } return ""; } }

Software Testing Is the menu bar displayed in the appropriate contested some system related features included either in menus or tools? Do pull –Down menu operation and Tool-bars work properly? Are all menu function and pull down sub function properly listed ?; Is it possible to invoke each menu function using a logical assumptions that if all parts of the system are correct, the goal will be successfully achieved .? In adequate testing or non-testing will leads to errors that may appear few months later. This create two problems: 1. Time delay between the cause and appearance of the problem. 2. The effect of the system errors on files and records within the system The purpose of the system testing is to consider all the likely variations to which it will be suggested and push the systems to limits. The testing process focuses on the logical intervals of the software ensuring that all statements have been tested and on functional interval is conducting tests to uncover errors and ensure that defined input will produce actual results that agree with the required results. Program level testing, modules level testing integrated and carried out. Testing is the process in which the system is run on manually created input so that the system is correctly working as desired or not. During systems testing, the system is used experimentally to ensure that the software does not fail. In other words, we can say that it will run according to its specifications and in the way users expect. Special test data are input for processing, and the results examined. A limited number of users may be allowed to use the system so that analyst can see whether they try to use it in unforeseen ways. It is desirable to discover any surprises before the organization implements the system and depends on it.

Testing of a system is generally done in two phases – One is Unit Testing which is done for each module independently on its completion and the other one is System Testing which is done at the end of a project. There are two major type of testing they are: 1) White Box Testing. 2) Black Box Testing.

White Box Testing White box sometimes called “Glass box testing” is a test case design uses the control structure of the procedural design to drive test case. Using white box testing methods, the following tests were made on the system a) All independent paths within a module have been exercised once. In our system, ensuring that case was selected and executed checked all case structures. The bugs that were prevailing in some part of the code where fixed b) All logical decisions were checked for the truth and falsity of the values.

Black box Testing Black box testing focuses on the functional requirements of the software. This is black box testing enables the software engineering to derive a set of input conditions that will fully exercise all functional requirements for a program. Black box testing is not an alternative to white box testing rather it is complementary approach that is likely to uncover a different class of errors that white box methods like.. 1) Interface errors 2) Performance in data structure 3) Performance errors

4) Initializing and termination errors

Validation Criteria The validation criteria in this project are as follows... In Student Information System, the user inputs are validated before storing them, and then further for displaying etc. The main validations that are done in Student Information System are as follows – All the screens have a similar look and feel. They all have the almost same color combinations in its background. This provides a better user interface to the users. 1) The primary key values cannot be duplicated. 2) All the entries in any combo box have been sorted in alphabetical order. This helps a user while selecting a value from the combo box. IMPORTANCE OF TESTING During systems testing, the system is used experimentally to ensure that the software does not fail. In other words, we can say that it will run according to its specifications and in the way users expect. Special test data are input for processing, and the results examined. The importance of system testing is that the system is expected to run according to member’s requirement before delivering it to the customer. The System is tested on the basis of specification so that it does not fail on user site.

Implementation and Testing

Implementation Detailed Design of Implementation - This phase of the systems development life

cycle

refines

programming

hardware

plans,

trains

and users

software and

specifications,

implements

establishes

extensive

testing

procedures, to evaluate design and operating specifications and/or provide the basis for further modification. Technical Design - This activity builds upon specifications produced during new

system

design,

adding

detailed

technical

specifications

and

documentation. Test Specifications and Planning - This activity prepares detailed test specifications

for

individual

modules

and

programs,

job

streams,

subsystems, and for the system as a whole. Programming and Testing - This activity encompasses actual development, writing, and testing of program units or modules. User Training - This activity encompasses writing user procedure manuals, preparation of user training materials, conducting training programs, and testing procedures. Acceptance Test - A final procedural review to demonstrate a system and secure user approval before a system becomes operational. Installation Phase - In this phase the new Computerized system is installed, the conversion to new procedures is fully implemented, and the potential of the new system is explored. System Installation: The process of starting the actual use of a system and training user personnel in its operation.

Review Phase - This phase evaluates the successes and failures during a systems development project, and to measure the results of a new Computerized Transystem in terms of benefits and savings projected at the start of the project. Development Recap - A review of a project immediately after completion to find successes and potential problems in future work. Post-Implementation Review - A review, conducted after a new system has been in operation for some time, to evaluate actual system performance against original expectations and projections for cost-benefit improvements. Also identifies maintenance projects to enhance or improve the system.

The steps in the software testing The steps involved during Unit testing are as follows: a) Preparation of the test cases. b) Preparation of the possible test data with all the validation checks. c) Complete code review of the module. d) Actual testing done manually. e) Modifications done for the errors found during testing. f) Prepared the test result scripts. The unit testing done included the testing of the following items: 1) Functionality of the entire module/forms. 2) Validations for user input. 3) Checking of the Coding standards to be maintained during coding. 4) Testing the module with all the possible test data. 5) Testing of the functionality involving all type of calculations etc. 6) Commenting standard in the source files. After completing the Unit testing of all the modules, the whole system is integrated

with

all

its

dependencies

in that

module.

While

System

Integration, We integrated the modules one by one and tested the system at each step. This helped in reduction of errors at the time of the system testing. The steps involved during System testing are as follows: 

Integration of all the modules/forms in the system.



Preparation of the test cases.



Preparation of the possible test data with all the validation checks.



Actual testing done manually.



Recording of all the reproduced errors.



Modifications done for the errors found during testing.



Prepared the test result scripts after rectification of the errors.

The System Testing done included the testing of the following items: 1. Functionality of the entire system as a whole. 2. User Interface of the system. 3. Testing the dependent modules together with all the possible test data scripts. 4. Verification and Validation testing. 5. Testing the reports with all its functionality. After the completion of system testing, the next following phase was the Acceptance Testing. Clients at their end did this and accepted the system with appreciation. Thus, we reached the final phase of the project delivery. There are other six tests, which fall under special category. They are described below: i.

Peak Load Test: It determines whether the system will handle the volume of activities that occur when the system is at the peak of its processing demand. For example, test the system by activating all terminals at the same time.

ii.

Storage Testing: It determines the capacity of the system to store transaction data on a disk or in other files.

iii.

Performance Time Testing: it determines the length of time system used by the system to process transaction data. This test is conducted prior to implementation to determine how long it takes to get a response to an inquiry, make a backup copy of a file, or send a transmission and get a response.

iv.

Recovery Testing: This testing determines the ability of user to recover data or re-start system after failure. For example, load backup copy of data and resume processing without data or integrity loss.

v.

Procedure Testing: It determines the clarity of documentation on operation and uses of system by having users do exactly what manuals request. For example, powering down system at the end of week or responding to paper-out light on printer.

vi.

Human Factors Testing: It determines how users will use the system when processing data or preparing reports.

Cost Estimation Of The Project Software cost comprises a small percentage of overall computer-based system cost. There are a number of factors, which are considered, that can affect the ultimate cost of the software such as - human, technical, Hardware and Software availability etc. The main point that was considered during the cost estimation of project was its sizing. In spite of complete software sizing, function point and approximate lines of code were also used to "size" each element of the Software and their costing. The cost estimation done by me for Project also depend upon the baseline metrics collected from past projects and these were used in conjunction with estimation variables to develop cost and effort projections. We have basically estimated this project mainly on two bases 1) Effort Estimation - This refers to the total man-hours required for the development of the project. It even includes the time required for doing documentation and user manual. 2) Hardware Required Estimation - This includes the cost of the PCs and the hardware cost required for development of this project.

GANTT CHART January

February

March

Requirement Gathering Analysis Design Coding Testing Implement W1 W2 W3 W4 W1 W2 W3 W4 W1 W2 W3 W4

Wi‘s are weeks of the months, for i =1, 2, 3, 4

Implementation Of Security Mechanisms At Various Levels Data Security System: The data security system will allow data to be securely transmitted between the various components. This includes transmission of product, merchant and customer information from the content management system to the website, and also the transmission of data from the website to the content management system. Folder Security using .htaccess:

The .htaccess (short for “Hypertext

Access”) file in your site’s directory is a configuration file you can use to override the settings on your web server. With the right commands, you can enable/disable extra functionality and features to protect your site from spammers, hackers and other threats. Prevent Directory Browsing: Protecting directories from being listed is, at best, security by obscurity. That is, its hiding your stuff from view, preventing meddling visitors from browsing through your directories. Really, its the web equivalent of hiding your cash under your mattress.Still, its good practice to prevent directory browsing, along with implementing other measures to secure your site. To disable browsing of your directories, add this to your .htaccess file: Options All –Indexes Restrict Access to Your Admin Area : A simple way to restrict access if your internet has a fixed IP address and you always access your site form the same location is by creating a new .htaccess file with the following snippet: order deny,allow allow from 192.168.5.1 deny from all

Conclusion Our project is only a humble venture to satisfy the needs in an Institution. Several user friendly coding have also adopted. This package shall prove to be a powerful package in satisfying all the requirements of the organization. The objective of software planning is to provide a frame work that enables the manger to make reasonable estimates made within a limited time frame at the beginning of the software project and should be updated regularly as the project progresses.

Bibliography 1) http://www.javaworld.com/javaworld/jw-01-1998/jw-01Credentialreview.html 2) Database Programming with JDBC and Java by O'Reilly 3) Head First Java 2nd Edition 4) http://www.jdbc-tutorial.com/ 5) Java and Software Design Concepts by APress

Future Scope As the project comes up with some limitations which can be improved in future and further more advancement can also be done. The different features that can be added are as follows: 

Videos of different news can be provided related to various fields like Entertainment, International, National, Sports, Business etc.



Reader can be alerted through e-mail, cell phones or other devices about availability of any new news of their interest.



Readers can easily forward interesting news items to others.



More fields can be added.



Live support should be enabled

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF