• Save
Summer Training report at TATA CMC
Upcoming SlideShare
Loading in...5
×
 

Summer Training report at TATA CMC

on

  • 14,553 views

 

Statistics

Views

Total Views
14,553
Views on SlideShare
14,553
Embed Views
0

Actions

Likes
12
Downloads
0
Comments
7

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

15 of 7 Post a comment

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • please send documents of core java based project
    for smart complain tracking system and also send ppt...
    Are you sure you want to
    Your message goes here
    Processing…
  • IT Pathshala Private Limited is an initiative of Myzeal IT Solutions and driven by a sustainable vision under which, the company is committed to provide robust and industry ready training and education to candidates in .NET technology. Our modules cover an advanced spectrum of topics. The curriculums are built by professional software developers that are available in both text and video formats.
    Key benefits of Our .NET Technology Training:
    • 100% Job assistance and In-House Job Opportunity
    • Opportunity to work upon Real On-going projects
    • Interaction with Industry Experts
    • Experience Letter on Training completion
    • Small Batches to focus on Each students

    Call our career and job experts: +91- 9650004158/8826299334 | Reach Us: H-110, Sector: 63, Noida-201301
    Are you sure you want to
    Your message goes here
    Processing…
  • IT Pathshala a globally recognized company for training cum 100% jobs which is initiative of Myzeal IT Solutions, Noida, a CMMI Level 3, Microsoft Certified Partner, ISO 9001:2008 compliant company offers Java training with 100% placement and hands-on practical practice. It’s a excellent training program, covers all major concepts and topics related to JAVA development and offers opportunity to work upon Real Live Projects developed in java and the instructor found the ways of explaining abstract concepts in a simple way, providing best conceptual practices.
    Our .Net Training with 100% Placement takeaways:
    • 100% guaranteed placement
    • Instructor mentoring available for ever
    • Real live international project experience
    • Guidance and supervision of experts and professionals
    • Experience Letter on Training Completion
    • Get certificate from reputed IT Company

    Call our career and job experts: +91- 9650004158 | Reach Us: H-110, Sector: 63, Noida-201301
    Are you sure you want to
    Your message goes here
    Processing…
  • pls enable slide
    Are you sure you want to
    Your message goes here
    Processing…
  • @Pallavi, i want 2 download this slides...
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Summer Training report at TATA CMC Summer Training report at TATA CMC Document Transcript

  • [Type a quote from the document or the summary of an interesting point. You can position the text box A anywhere in the document. Use the Text Box Tools tab to change the Training Report formatting of the pull quote text box.] Of Summer Training Project At On ADVANCED JAVA Submitted In The Partial Fulfillment of Bachelor of Technology Department of Computer Science J.P. Institute of Engineering and Technology 2012-13Submitted to : Submitted by:Mr. Shreyaskar Gaur Name :Pallavi SrivastavaAssistant Professor B.Tech (C.S.E):4th yrDepartment of Computer Science & Semester :7Technology Roll no. :0928210035J. P. Institute of Engineering Technology 1
  • CertificateI am, Pallavi Srivastava, student of B.Tech (CSE), 4th year of J.P Institute of Engineering andTechnology, Meerut completed my summer project from Tata CMC from June 11 ,2012 to July 26,2012.During the mentioned period I worked at Advanced JAVA and completed my summer trainingproject entitled “Centralized Hospital Management” under the guidance of Mr. Vikrant Singh.Date: Name:Pallavi Srivastava 2
  • [Type a quote from the document or the summary of an interesting point. You can position the text box anywhere in the document. Use the Text Box Tools tab to change the formatting of the pull quote text box.] Acknowledgement “Gratitude is not a thing of expression; it is more matter of feeling."There is always a sense of gratitude which one express towards others for their help and supervisionin achieving the goals. This formal piece of acknowledgement is an attempt to express the feeling ofgratitude towards people who helpful me in successfully completing of my trainingI would like to express my deep gratitude to Mr. Vikrant Singh ,my training coordinator for theirconstant co-operation. He was always there with his competent guidance and valuable suggestionthroughout the pursuance of this research project.I would also like to place of appreciation to all the respondents and group members whoseresponses and coordination were of utmost importance for the project.Above all no words can express my feelings to my parents, friends all those persons who supportedme during my project. I am also thankful to all the respondents whose cooperation & support hashelped me a lot in collecting necessary information 3
  • Table of contentsCertificate(by company) .......................................................................................................................... iCertificate ............................................................................................................................................... iiAcknowledgement ................................................................................................................................. iiiTable of contents ................................................................................................................................... ivList of figures ......................................................................................................................................... viList of tables...........................................................................................................................................vii 1. Company Profile ......................................................................................................................... 1 1.1. Core products/solutions ................................................................................................... 3 1.2. Some Clients of Company ................................................................................................. 3 1.3. Company services in technology ....................................................................................... 5 2. Technology ................................................................................................................................. 6 1.1. Introduction to JAVA ........................................................................................................ 6 1.2. J2EE ................................................................................................................................. 6 1.3. MVC architecture ............................................................................................................. 7 1.4. JAVABEANS ...................................................................................................................... 8 1.5. JDBC ................................................................................................................................. 8 1.6. Servlets .......................................................................................................................... 14 1.7. JSP ................................................................................................................................. 17 3. Project ...................................................................................................................................... 24 1.1. Object ............................................................................................................................ 24 1.2. Scope ............................................................................................................................. 24 1.3. Technology to be used ................................................................................................... 25 1.4. Tools to be used ............................................................................................................. 25 1.5. Roles of users ................................................................................................................. 25 4
  • 4. Modules of Project(on which I worked) ................................................................................... 27 1.1. EMR ............................................................................................................................... 27 1.2. Online appointment ....................................................................................................... 285. References ............................................................................................................................... 30 5
  • List of FiguresFigure no. Title Page no.2.1 MVC architecture 72.2 JDBC drivers 112.3 Lifecycle of servlet 152.4 JSP 182.5 JSP compilation 182.6 JSP tags 193.1 Use case for patient 213.2 Use case for doctor 274.1 EMR module webpage 284.2 EMR records webpage 294.3 Online appointment webpage 30 6
  • List of TablesTable no. Title Page no.4.1 EMR 74.2 Appointment Table 11 COMPANY PROFILECMC Limited is a leading systems engineering and integration company in India,offering application design, development, testing services and asset-basedsolutions in niche segments through turnkey projects of national importance. CMChas also been expanding its service presence in international markets offeringoff-shoring advantages and delivering value through service level-based andproject scope-based deliveries.Since its inception on December 26, 1975, CMC has been a frontrunner in providing ITCMC MUMBAI 1 solutions andservices. CMC was the first ever enterprise in India to set up a countrywide data network calledINDONET - a computer network providing access to major cities in India, way back in 1985.A subsidiary of Tata Consultancy Services Limited (TCS Ltd), one of the worlds leading informationtechnology consulting, services and business process outsourcing organisations, CMC Limited is apart of the US$ 83.3 billion Tata Group, Indias best known business conglomerate.Today, CMC Limited, an ISO 9001:2000, certified and CMMI Level V accredited organisation, ispositioned as a premier IT solutions provider in the fast growing and competitive IT market.CMC’s execute large and complex turnkey projects, and have built, managed and supported ourcustomers IT systems across the value chain infrastructure, applications and business processes.A few highlights of CMC’s business 7
  •  Over 10775 employees spread across India, USA, UK, Europe, MEA & APAC 3300+ experts in technologies & domain for Application Development Practice 978 strong skilled force in Embedded Systems 11 Development Centres across India and USA Experience in setting up large ODCs up to 300+ team CMC has 18 offices in major Indian cities and over 150 service locations. CMC’s have a sizable resource pool of engineers trained in diverse technologies, with vast domain knowledge and varied skill set. CMC’s conduct significant research into emerging technologies and competence areas at our state- of-the-art, ISO 9001 certified R&D Centre in Hyderabad, India. This gives us an edge in complex, high technology projects. CMC over the years has followed a multi-dimensional approach to support its growth and expansion in becoming a global player. Together with Tata Consultancy Services Limited (TCS Ltd), our strategic partner, CMC’s are working to target the global market with additional offerings that leverage our combined strengths and enable us to follow common best practices. CMCs wholly owned subsidiary, CMC Americas Inc, was acquired in 1991 and formerly called Baton Rouge International (BRI), before being renamed in 2003. With 9 offices in USA and servicing customers across the country, it drives CMCs thrust towards globalisation and business development in USA. In addition to the following, CMC Americas Inc also maintains offices in Austin, TX; Los Angeles, CA; Sunnyvale, CA; Atlanta, Georgia; Baton Rouge, LA; Novi, MI; Edison, NJ; Reston, VA and Burlington, MA. CMC Informatics UK is the branch office of CMC Limited in the United Kingdom and covers the territories of UK, Ireland and Europe. The office is based in the historic city of Guildford in Surrey, one of richest counties in the UK. CMCs products for transport, law enforcement, banking and insurance verticals, and services in 8
  • embedded technologies, IT Consultancy and Infrastructure Development Management andOutsourcing are offered through this office. The London Underground Limited (LUL), Forth Ports andTRW are a few of our CMC’sll known clients.CMC Dubai is the branch office of CMC in west Asia and serves as a front end for CMCs thruststowards globalization, especially in terms of business development in the Middle East and Africa.The Dubai office handles large projects for important clients like the National Bank of Bahrain andSyrian Railways. In Africa, the Tanzania Police is also handled from this office.Global presence • CMC Americas – USA • CMC Informatics – UK • CMC Dubai – Middle East • CMC Ltd – Presence in almost all cities of IndiaCore Products/Solutions  Transport ARTS, IMPRESS, FOIS, Train Scheduling  Port Solutions MACH, CALM  Banking: TC4  Insurance: GENISYS  Fingerprint Tracing System FACTS  Event Management System  Mining DYNAMINE  Securities VECTOR, VEDAS  Tourism VISTA  Health FHIMS  Embedded Systems TU, ANIB  eCommerce ICert, E-bill Pay, E-Cheque  eGovernance VOICE, VCOPS KHAJANE, MUKHYA VAHINI 9
  •  Water Resources WRMSome of CMC’s Clients  Reserve Bank of India  Indian Railways  Indian Oil Corporation  Bharat Petroleum Corporation India  Oil and Natural Gas Corporation Ltd.  United western Bank  Bank of India  Bank of BarodaShipping  Mumbai Port Trust  Chennai International Terminal  Adani Port  Forth Ports Plc, UK  Norfolklines BV, Netherlands  P&O PortsManufacturing Energy Resources & Utilities  Sesa Goa  IOCL  TATA steel  TATA PowerEducation and training  Mahindra British Telecom  ICICI Bank  WIPRO  SmithKline Beecham 10
  •  Robert Bosche  IIT Kharagpur  Ministry of External Affairs  Reserve Bank of India  State Bank of India  Calcutta TelecomHitech & Telecom  Tata Teleservices  Bharat Sanchar Nigam  IBM Daksh Business Process Services  Mahanagar Telephone Nigam  Miro Technologies  Cadence TechnologiesDefence & Space  Indian Air Force  Ordnance Factory Board, Ministry of Defence  Department of Space  ISRO  DRDO  Indian Navy  National Remote Sensing AgencySoftware / Firmware Development in JAVA  Application Development  Device Drivers & Board Support Packages  Protocol Stacks  Simulators & Tools Development  GUI Design 11
  • TECHNOLOGYIntroduction to javaJava is a programming language initially developed by Sun Microsystems and released as aprincipal component of Sun Microsystems Java platform. Although the language gets much of itssyntax from C and C++ it has a less complicated object model and lesser low-level services. Javaapplications are typically compiled to byte code (class file)that can run on any Java Virtual Machine(JVM) regardless of computer architecture .Java is a general-purpose, object-oriented language thatis specifically designed to have as few implementation dependencies as possible. It is intended tolet application developers "write once, run anywhere". Java is currently one of the most standardprogramming languages in use, and is extensively used from application software to webapplications. There were five primary goals in the creation of the Java language :.  It should be "simple, object-oriented and familiar".  It should be "robust and secure".  It should be "architecture-neutral and portable".  It should execute with "high performance".  It should be "interpreted, threaded, and dynamic".J2EEShort for Java 2 Platform Enterprise Edition, J2EE is a platform-independent ,Java- centricenvironment from Sun for developing, building and deploying Web-based enterprise applicationsonline. The J2EE platform consists of a set of services, APIs, and protocols that provide the 12
  • functionality for developing multitier, Web-based applications.Some of the key features and services of J2EE  At the client tier, J2EE supports pure HTML ,as well as Java applets or applications. It relies on Java Server Pages and servlet code to create HTML or other formatted data for the client  Enterprise JavaBeans(EJBs) provide another layer where the platforms logic is stored. An EJB server provides functions such as threading, concurrency ,security and memory management. These services are transparent to the author.  Java Database Connectivity(JDBC), which is the Java equivalent to ODBC,is the standard interface for Java databases.  The Java servlet API enhances consistency for developers without requiring a graphical user interface.MVC ArchitectureModel–View–Controller (MVC) is an architecture that separates the representation of informationfrom the users interaction with it. The model consists of application data and business rules, andthe controller mediates input, converting it to commands for the model or view.A view can be anyoutput representation of data, such as a chart or a diagram. Multiple views of the same data arepossible, such as a pie chart for management and a tabular view for accountants. The central ideabehind MVC is code reusability and separation of concerns. 13
  • Figure 2.1 MVC ArchitectureJAVA BEANSJavaBeans are reusable software components forJava that can be manipulated visually in a buildertool. Practically, they are classes written in the Java programming language conforming to aparticular convention. They are used to encapsulate many objects into a single object (the bean), sothat they can be passed around as a single bean object instead of as multiple individual objects. AJava Bean is a Java Object that is serializable, has a nullary constructor, and allows access toproperties using getter and setter methods.JAVA BEANS CONVENTIONSIn order to function as a Java Bean class ,an object class must obey certain conventions aboutmethod naming, construction, and behavior. These conventions make it possible to have tools thatcan use, reuse, replace, and connect Java Beans. The required conventions are as follows:The class must have a public default constructor(no-argument). This allows easy instantiation within 14
  • editing and activation frameworks.The class properties must be accessible using get , set ,is(used for Boolean properties instead ofget) and other methods (so-called accessor methods andmutator methods), following a standardconvention. This allows easy automated inspection and updating of bean state within frameworks,many of which include custom editors for various types of properties.The class should be serializable. It allows applications and frameworks to reliably save, store, andrestore the beans state in a fashion independent of the VM and of the platform.BASIC BEAN CONCEPTSIndividual Java Beans will vary in functionality, but most share certain common defining features.  Support for introspection allowing a builder tool to analyze how a bean works.  Support for customization allowing a user to alter the appearance and behavior of a bean.  Support for events allowing beans to fire events, and informing builder tools about both the events they can fire and the events they can handle.  Support for properties allowing beans to be manipulated programmatically, as well as to support the customization mentioned above  Support for persistence allowing beans that have been customized in an application builder to have their state saved and restored. Typically persistence is used with an application builders save and load menu commands to restore any work that has gone into constructing an application.While Beans are intended to be used primarily with builder tools, they need not be .Beans can bemanually manipulated by text tools through programatic interfaces. Allkey APIs, including support forevents, properties, and persistence, have been designed to be easily read and understood byhuman programmers as well as by builder tools.The JavaBeans™ architecture is based on a component model which enables developers to createsoftware units called components. Components are self-contained, reusable software units that canbe visually assembled into composite components, applets, applications, and servlets using visualapplication builder tools. Java Bean components are known as beans .A set of APIs describes a 15
  • component model for a particular language.The JavaBeans API specification describes the core detailed elaboration for the JavaBeanscomponent architecture .Beans are dynamic in that they can be changed or customized. Throughthe design mode of a builder tool you can use the Properties window of the bean to customize thebean and then save (persist) your beans using visual manipulation. You can select a bean from thetoolbox, drop it into a form, modify its appearance and behavior, define its interaction with otherbeans, and combine it and other beans into an applet, application, or a new bean .The following listbriefly describes key bean concepts.  Builder tools discover a beans features (that is, its properties, methods, and events) by a process known as introspection. Beans support introspection in twoways: o By adhering to specific rules, known as design patterns, when naming bean features. The Introspector class examines beans for these design patterns to discover bean features. The Introspector class relies on the core reflection API. The trail Getting Startedis an excellent place to learn about reflection. o By explicitly providing property, method, and event information with a related bean information class. A bean information class implements the Bean Info interface. A Bean Info class explicitly lists those bean features that are to be exposed to application builder tools.  Properties are the appearance and behavior characteristics of a bean that can bechanged at design time. Builder tools introspect on a bean to discover itsproperties and expose those properties for manipulation.  Beans expose properties so they can be customized at design time.  Customization is supported in two ways: by using property editors, or by using moresophisticated bean customizers.  Beans use Events to communicate with other beans. A bean that is to receive events (a listener bean) registers with the bean that fires the event (a source bean). Builder tools can examine a bean and determine which events that bean can fire (send) and which it can handle (receive).  Persistence enables beans to save and restore their state. After changing a beans properties, you can save the state of the bean and restore that bean at a later time with the property changes intact. The JavaBeans architecture uses Java Object Serialization to support persistence  A beans methods are no different from Java methods, and can be called from other beans or a scripting environment. By default all public methods are exported. Beans vary in functionality and purpose. You have probably met some of the following beans in your programming practice: 16
  • GUI (graphical user interface)  Non-visual beans, such as a spelling checker  Animation applet  Spreadsheet applicationBEAN DEVELOPMENT KITJavaBeans are reusable software components written in Java. These components maybe builtinto an application using an appropriate building environment. The Bean Development Kit(BDK) from Sun includes a simple example of a building environment which uses beans, calledthe bean box, and some sample beansThe Java Database Connectivity (JDBC)The Java Database Connectivity (JDBC) API is the industry standard for database-independentconnectivity between the Java programming language and a wide range of databases – SQLdatabases and other tabular data sources, such as spreadsheets or flat files. The JDBC APIprovides a call-level API for SQL-based database access.JDBC technology allows you to use the Java programming language to exploit "Write Once, RunAnywhere" capabilities for applications that require access to enterprise data. With a JDBCtechnology-enabled driver, you can connect all corporate data even in a heterogeneousenvironment.JDBC driversThere are commercial and free drivers available for most relational database servers. These driversfall into one of the following types: Type 1 that calls native code of the locally available ODBC driver. Type 2 that calls database vendor native library on a client side. This code then talks to database over network. 17
  •  Type 3, the pure-java driver that talks with the server-side middleware that then talks to database. Type 4, the pure-java driver that uses database native protocol. Figure 2.2 JDBC driversFunctionality and implementationJDBC allows multiple implementations to exist and b e used by the sameapplication.The API provides a mechanism for dynamically loading the correct Javapackages and registering them with the JDBC Driver Manager. The Driver Manager isused as a connection factory for creating JDBC connections.JDBC connections supportcreating and executing statements. These may be update statements such as SQLsCREATE, INSERT, UPDATE and DELETE, or they may bequery statements such asSELECT. Additionally,stored proceduresmay be invoked through a JDBC connection.JDBC represents statements using one of the following classes: Statement – the statement is sent to the database server each a nd every time. 18
  • PreparedStatement – the statement is cached and then the execution path ispredetermined on the database server allowing it to be execute d multiple times inanefficient manner. CallableStatement –used for executingstored procedureson the database.Updatestatements such as INSERT, UPDATE and DELETE return an update count thatindicates how many rows were affected in the database.These statements do notreturn any other information.Query statements return a JDBCrow result set. The row result set is used to walk overthe result set. Individual columnsin a row are retrieved either b y name or by column number. There may be any numberof rows in the result set. The row result set has metadata that describes the names ofthe columns and their types.There is an extension to the basic JDBC API inthejavax.sql. The methodClass.forName(String) is used to load the JDBC driverclass.Example :Class.forName(―sun.jdbc.odbc.JdbcOdbcDriver‖); used to load the JDBC-ODBC bridge driver.When aDriverclass is loaded, it creates aninstance of itself and registers it with the DriverManager. Now when a connection isneeded, one of the DriverManager.getConnection() methodsis used to create a JDBCconnection.Example;import java.sql.*;import javax.sql.*;public class jdbcdemo{public static void main(String args[]){String dbtime;String dbUrl = "jdbc:mysql://your.database.domain/yourDBname";String dbClass = "com.mysql.jdbc.Driver";String query = "Select * FROM users";try {Class.forName("com.mysql.jdbc.Driver");Connection con = DriverManager.getConnection (dbUrl);Statement stmt = con.createStatement();ResultSet rs = stmt.executeQuery(query); 19
  • while (rs.next()) {dbtime = rs.getString(1);System.out.println(dbtime);} //end whilecon.close();} //end trycatch(ClassNotFoundException e) {e.printStackTrace();}catch(SQLException e) {e.printStackTrace();}} //end main} //end classIf a database operation fails, JDBC raises an SQLException.There is typically verylittle one can do to recover from such an error, apart from logging it with as muchdetail as possible. It is recommended that the SQLException be translated into anapplication domain exception (an unchecked one) that eventually results in atransaction rollback and a notification to the user.Finally to summarize, the following points can be stated :  JDBC API provides a database programming interface for Java programs. AJava program can send queries to a database b y using the JDBC driver.  The java.sql package contains classes that help in connecting to a database, sending SQL statements to the database and processing the query results.  The Connection Object represents a connection with a database. It can beinitialized using the getConnection() method of the DriverManager class.  The PreparedStatement object allows you to execute parameterized queries. Itcan be initialized using the prepareStatement() method of the Connection object. 20
  •  The setString() method sets the quer y parameters of the PreparedStatementobject.  The executeUpdate() method executes the query statement present in thePreparedStatement object and returns the number of rows affected by the query.  The ResultSetMetaData interface is used to obtain information about thecolumns stored in a ResultSet objectServletsServlets are protocol and platform independent server-side software components, written in Java.They run inside a Java enabled server or application server, such as the WebSphere ApplicationServer. Servlets are loaded and executed within the Java Virtual Machine (JVM) of the Web serveror application server, in much the same way that applets are loaded and executed within the JVM ofthe Web client.Since servlets run inside the servers, however, they do not need a graphical user interface (GUI). Inthis sense, servlets are also faceless objects.Servlets more closely resemble Common Gateway Interface (CGI) scripts or programs than appletsin terms of functionality. As in CGI programs, servlets can respond to user events from an HTMLrequest, and then dynamically construct an HTML response that is sent back to the client.The Java Servlet APIThe Java Servlet API is a set of Java classes which define a standard interface between a Webclient and a Web servlet. Client requests are made to the Web server, which then invokes the servletto service the request through this interface.The API is composed of two packages:  javax.servlet  javax.servlet.httpThe Servlet interface class is the central abstraction of the Java Servlet API. This class defines themethods which servlets must implement, including a service() method for the handling of requests. 21
  • The GenericServlet class implements this interface, and defines a generic, protocol-independentservlet.To write an HTTP servlet for use on the Web, we will use an even more specialized class ofGenericServlet called HttpServlet.HttpServlet provides additional methods for the processing ofHTTP requests such as GET (doGet method) and POST (doPost method). Although our servletsmay implement a service method, in most cases we will implement the HTTP specific requesthandling methods of doGet and doPost.Servlet Life Cycle Figure 2.3 Lifecycle of ServletThe life cycle of a servlet can be categorized into four parts: 1. Loading and Instantiation: The servlet container loads the servlet during startup or when the first request is made. The loading of the servlet depends on the attribute <load-on- startup> of web.xml file. If the attribute <load-on-startup> has a positive value then the servlet is load with loading of the container otherwise it load when the first request comes for service. After loading of the servlet, the container creates the instances of the servlet. 22
  • 2. Initialization: After creating the instances, the servlet container calls the init() method and passes the servlet initialization parameters to the init() method. The init() must be called by the servlet container before the servlet can service any request. The initialization parameters persist untill the servlet is destroyed. The init() method is called only once throughout the life cycle of the servlet.The servlet will be available for service if it is loaded successfully otherwise the servlet container unloads the servlet. 3. Servicing the Request: After successfully completing the initialization process, the servlet will be available for service. Servlet creates seperate threads for each request. The sevlet container calls the service() method for servicing any request. The service() method determines the kind of request and calls the appropriate method (doGet() or doPost()) for handling the request and sends response to the client using the methods of the response object. 4. Destroying the Servlet: If the servlet is no longer needed for servicing any request, the servlet container calls the destroy() method . Like the init() method this method is also called only once throughout the life cycle of the servlet. Calling the destroy() method indicates to the servlet container not to sent the any request for service and the servlet releases all the resources associated with it. Java Virtual Machine claims for the memory associated with the resources for garbage collection.A simple servlet examplepackage itso.servjsp.servletapi;import java.io.*;import javax.servlet.*;import javax.servlet.http.*;public class SimpleHttpServlet extends HttpServlet {protected void service(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException {res.setContentType("text/html");PrintWriter out = res.getWriter();out.println("<HTML><TITLE>SimpleHttpServlet</TITLE><BODY>"); 23
  • out.println("<H2>Servlet API Example - SimpleHttpServlet</H2><HR>");out.println("<H4>This is about as simple a servlet as it gets!</H4>");out.println("</BODY><HTML>");out.close();}}JavaServer Pages (JSP)JavaServer Pages (JSP) is a technology that helps software developers create dynamicallygenerated web pages based on HTML, XML, or other document types. Released in 1999 by SunMicrosystems[1], JSP is similar to PHP, but it uses the Java programming language.To deploy and run Java Server Pages, a compatible web server with a servlet container, suchas Apache Tomcat or Jetty, is required.Java Server Pages is a technology which permits software developers to create dynamic requestlike HTML, XML in order to answer to client request in the net. This technology lets Java code anddefinite pre-defined procedures to be implanted into static content. The syntax in Java Server Pagesincludes a supplementary XML tag which is known as JSP actions.It is made use to evoke the utility of the built-in functions. Moreover JSP permits to establish andform the JSP tag libraries which operate as an extension to the standard XML or HTML tags. TheseJSP tag libraries give a good technique to widen the potentiality of the Web server by providing anindependent platform.JSP compiler compiles the JSPs into Java Servlets. 24
  • Figure 2.4 JSPA JSP compiler may possibly create a servlet in Java code and it is later compiled by the Javacompiler. It might even directly produce the byte code for the servlet. Java Server Pages can beexamined as a high level abstraction of servlets which is practiced as an extension of theServlet2.1API.Java Server Pages are HTML pages embedded with snippets of Java code.It is an inverse of a JavaServletJSPs run in two phases  Translation Phase- In translation phase JSP page is compiled into a servlet called JSP Page Implementation class  Execution Phase- In execution phase the compliled JSP is processed 25
  • Figure 2.5 JSP compilationThe Java Server Pages and the Servlets were initially developed at Sun Microsystems. Opening withversion 1.2 of the Java Server Page specification the JSPs have been built under the JavaCommunity Process.There are quite a few JSP implicit objects that are represented by the JSPcontainer and it could be mentioned and indicated by the programmers 26
  •  Config - It gives the data of the servlet configuration Application - Datas are shared by the servlets and Java Server Pages in theapplication. Exception - Exceptions are not trapped by the codes in the application. Out - The datas are written with the help of JSP Writer to the response stream. Request - Here the Hypertext Transfer Protocol request the object. Response - Here the Hypertext Transfer Protocol response the object Session - It is helpful to trace the datas and information about a user from one request to another requestThere are several actions that are performed in JSP actions. A JSP action is nothing but a XMLtags that invokes functionality of the built-in web server. Some of the JSP action is given asfollows. Jsp:param - It indicates a parameter which will be added in addition to the request of the existing parameters. It is used inside the jsp:params or jsp:include, jsp:forwardblocks Jsp:include - Java Servlet provisionally gives the request and response off to the specific Java Server Page. The Control will later come again to the existing JSP as soon as theother JSP has completed. With the help of this the JSP code will be distributed among several other JSPs rather than replica. Jsp:forward - This JSP action is used to give off the request/response to the other servlet or JSP. The control will not come back to the existing JSP. Jsp:plugin - The ancient version of web browsers like Internet Explorer and Netscape Navigator use various tags to embed an applet. This action creates the definite tags that are required for a browser to include an applet. 27
  •  Jsp:fallback - This action is used to confirm that if the browser never gives support to applets.  Jsp:getProperty - It obtains a property from the specific JavaBean.  Jsp:setProperty - It sets a property in the specific JavaBeanJSP Tags Figure 2.6 JSP Tags 28
  • JSP scripting elementsJSP scripting elements let you insert Java code into the servlet that will be generated from thecurrent JSP page. There are three forms:  Expressions of the form <%= expression %> that are evaluated and inserted into the output,  Scriptlets of the form <% code %> that are inserted into the servlets service method, and  Declarations of the form <%! code %> that are inserted into the body of the servlet class, outside of any existing methodJSP DirectiveA JSP Directive affects the overall structure of the servlet class. It usually has thefollowing form:<%@ directive attribute="value" %>However, you can also combinemultiple attribute settings for a single directive, as follows:<%@ directive attribute1="value1"attribute2="value2"...attributeN="valueN" %>There are two main types of directive: page, which lets you do things like import classes,customize the servlet superclass, and the like; and include, which lets you insert a file intothe servlet class at the time the JSP file is translated into a servlet. The specification alsomentions the taglib directive, which is not supported in JSP version 1.0, but is intended tolet JSP authors define their own tags. It is expected that this will be the main newcontribution of JSP 1.Implicit objects in jsp are the objects that are created by thecontainer automatically and the container makes them available to the developers, thedeveloper do not need to create them explicitly. Since these objects are createdautomatically by the container and are accessed using standard variables; hence, they arecalled implicit objects.JSP Implicit Objects are as follows: 1. request implicit object The JSP implicit request object is an instance of a java class that implements the javax.servlet.http.HttpServletRequest interface. It represents the request made by the client. 29
  • The request implicit object is generally used to get request parameters, request attributes, header information and query string values.2. response implicit object The JSP implicit response object is an instance of a java class that implements the javax.servlet.http.HttpServletResponse interface. It represents the response to be given to the client. The response implicit object is generally used to set the response content type, add cookie and redirect the response.3. out implicit object The JSP implicit out object is an instance of the javax.servlet.jsp.JspWriter class. It represents the output content to be sent to the client. The out implicit object is used to write the output content.4. session implicit object The JSP implicit session object is an instance of a java class that implements the javax.servlet.http.HttpSession interface. It represents a client specific conversation. The session implicit object is used to store session state for a single user.5. application implicit object The JSP implicit application object is an instance of a java class that implements the javax.servlet.ServletContext interface. It gives facility for a JSP page to obtain and set information about the web application in which it is running.6. exception implicit object The JSP implicit exception object is an instance of the java.lang.Throwable class. It is available in JSP error pages only. It represents the occured exception that caused the control to pass to the JSP error page.7. config implicit object The JSP implicit config object is an instance of the java class that implements javax.servlet.ServletConfig interface. It gives facility for a JSP page to obtain the initialization parameters available.8. page implicit object 30
  • The JSP implicit page object is an instance of the java.lang.Object class. It represents the current JSP page. That is, it serves as a reference to the java servlet object that implements the JSP page on which it is accessed. It is not advisable to use this page implict object often as it consumes large memory. 9. pageContext implicit object The JSP implicit pageContext object is an instance of the javax.servlet.jsp.PageContext abstract class. It provides useful context information. That is it provides methods to get and set attributes in different scopes and for transferring requests to other resources. Also it contains the reference to to implicit objects.JSP actionsJSP actions use constructs in XML syntax to control the behavior of the servlet engine. You candynamically insert a file, reuse JavaBeans components, forward the user to another page, orgenerate HTML for the Java plugin. Available actions include:  jsp:include - Include a file at the time the page is requested.  jsp:useBean - Find or instantiate a JavaBean.  jsp:setProperty - Set the property of a JavaBean.  jsp:getProperty - Insert the property of a JavaBean into the output jsp:forward - Forward the requester to a new page.  jsp:plugin - Generate browser-specific code that makes an OBJECT or EMBED tag for the Java plug-in. 31
  • PROJECTObjectCentralized hospital management is a web application which provides online medical services toeveryone at their doorstep.Users  There are three basic users –  Patient,  Admin,  DoctorsScope  All users have their own profiles in Medical Clinic.  Patients can search for doctor and make online appointments. They also can view their health record and doctor’s prescription. Patient can also register complaint on any doctor.  Doctor’s can give appointments, e-prescription and can view patient’s health record  Admin has the authority to add/delete users, doctors or hospitals and grant permission to doctors.modules  Login for doctors and patient  Updates about treatments and surgery  Patient reviews and ratings for doctor.  Registration for users.  Online maintenance of health record.(EMR) or Electronic medical records  Online prescription from doctor.  Online appointment facility. 32
  • Technologies to be used  UML,  J2EE,  XML,  e-Forms,  AJAX,  Web 2.0,  Web-services,  SOATools to be used  Glassfish server  Netbeans IDE  Oracle 10G Express EditionRoles of users  Doctor: Doctor’s can give appointments, e-prescription and can update and view patient’s health record. 33
  •  Patient :Patients can search for doctor and make online appointments. They also canview their health record, lab reports, doctor’s prescription and medical expenses. Patient canalso register complaint on any doctor. Fig3.1: Use case diagram for patient Admin: Admin has the authority to add/delete users, grant permission to doctors andkiosk manager, to generate and view reports. He also views the complaints of patients andtakes necessary actions 34
  • MODULES OF PROJECTelectronic medical record (EMR)An electronic medical record (EMR) is a computerized medical record created in an organizationthat delivers care, such as a hospital or physicians office.Electronic medical records tend to be apart of a local stand-alone health information system that allows storage, retrieval and modificationof records. Some EMR systems automatically monitor clinical events, by analyzing patient datafrom an electronic health record to predict, detect and potentially prevent adverse events. Thiscan include discharge/transfer orders, pharmacy orders, radiology results, laboratory results andany other data from ancillary services or provider notes. Figure 4.1 EMR module webpageThis EMR module allows a user to view his past medical records online either by entering one of thefollowing:  Date  Doctor’s name 35
  • The output will show the records which are relevant. Figure 4.2 EMR recordsEMR table in database Colu mn Na me Data T ype N ulla b le Defa ult P rimar y Ke y U_ID NUMBER No - - DATEOFVISIT DATE Yes - - DIAGONOSIS VARCHAR2(4000) Yes - - PRESCRIPTION VARCHAR2(4000) Yes - - WEIGHT NUMBER Yes - - HEIGHT NUMBER Yes - - DOCTOR VARCHAR2(4000) Yes - - DD NUMBER Yes - - MON VARCHAR2(4000) Yes - - YY NUMBER Yes - - D_ID VARCHAR2(20) Yes - -Table 4.1 EMR 36
  • Online AppointmentThis module connects patients with doctors and provides information about medical requirements asand whenever required. We allow patients to conveniently schedule their appointments with thedoctors of their choice, as per the given criterion depending on the kind of disease or problem theyare suffering through at present or in general. Now, patients need not wait longer in queues forappointments and check ups at any doctors clinic or hospitals. Figure 4.3 Online AppointmentAppiontment database tableColu mn Na me Data T ype N ulla b le Defa ult P rimar y Ke yU_ID VARCHAR2(40) No - -APPT_DATE DATE Yes - -TIME VARCHAR2(4000) Yes - -STATUS VARCHAR2(4000) Yes - -P_ID VARCHAR2(40) Yes - -Table 4.2 Appointment table 37
  • REFERENCES* www.cmcltd.com* .wikipedia.org/wiki* www.scribd.com* Complete Reference to JAVA2* Sun Microsystems and Cmc study material 38