You are on page 1of 20

PROJECT REPORT

Online Dictionary
SUBMITTED IN PARTIAL FULFILMENT OF THE DEGREE OF

BACHELOR OF TECHNOLOGY

by

Jagannath Hemram Manas Ranjan Paramanik

Under the guidance of

Mrs. Priya Chandran

Department of Computer Engineering

National Institute of Technology, Calicut

National Institute of Technology, Calicut


Department of Computer Engineering
Certified that this Project Report entitled

Online Dictionary
is a bonafide report of the project presented by

Jagannath Hemram
Manas Ranjan Paramanik

in partial fulfillment of the degree of

Bachelor of Technology
under our guidance

_______________________________________________________________

Mrs. Priya Chandran


Asst. Professor Dept.of Computer Engineering

Dr. V.K. Govindan


Professor and Head Dept.of Computer Engineering

Acknowledgement
We are deeply indebted to Mrs. Priya Chandran, Asst. Professor of Computer Science and Engineering, for all help, guidance and encouragement given for the project. We would like to express our sincere gratitude to our friends who have been constantly source of help and encouragement. Jagannath Hemram Manas Ranjan Paramanik

Abstract
A good online dictionary can be fast, efficient, and more current than print editions. Better still, consulting an online dictionary may be more convenient than unearthing the cumbersome desk dictionary from a growing mound of journals and manuscripts. Whether print or online, dictionaries are helpful only if they include the words that users are seeking. Unfortunately, many dictionaries available on the Web are not so good. After selecting 15 uncommonbut not quite obscurewords from various fields of science, editing, publishing, and emerging technologies, we entered them into the search field of each dictionary. Some online dictionaries like WordNet (Princeton University), the Free Online Dictionary of Computing, and CancerWEBs Online Medical Dictionary are devoted to single dictionaries and do not provide the variety of additional resources. But our Online Dictionary providing three types of dictionaries, general English dictionary, Medical dictionary and Computer dictionary. Along with this we are also providing the feature of spelling check of the word, which will be typed.

ii

Contents
1 Introduction 2 Problem Definition 2.1 Motivation 3 Overview of Servlets 3.1 Use Servlets instead of CGI Scripts 3.2 Other Uses for Servlets 3.3 Architecture of the Servlet Package 3.4 Interface Servlet and the Servlet Lifecycle 3.5 HttpServlet class 3.6 HttpServletRequest Interface 3.7 HttpServletResponse Interface 4 Java Database Connectivity 4.1 JDBC-ODBC Bridge 4.2 The SQL (Structured Query Language) Language 5 Installing a JSP Container Jakarta Tomcat 5.1 Installation 5.2 Starting and Stopping Tomcat 5.3 Setting Environment Variables 5.4 Configuring Tomcat to Work with Apache 6 Design of Project 6.1 Implementation Decision and Justification 6.2 Implementation of Database 6.2.1 Creating the Database 6.2.2 Creating a Table 6.2.3 Creating a Table Using JDBC 6.2.4 Deleting or Dropping a Table 6.2.5 The INSERT Statement 6.2.6 The UPDATE Statement 6.2.7 Searching the Word 6.2.8 Spelling Check 7 Conclusion References 1 1 1 2 2 2 3 3 4 4 4 4 5 5 6 6 6 7 7 8 8 8 8 9 9 10 10 10 12 12 14 15

iii

1 Introduction
When a general online dictionary just doesnt suffice, it may be time to look at some of the specialized dictionaries available on the Web. There are online dictionaries and glossaries devoted to almost every branch of science and technology. For example, the University of Texas hosts BioTech Life Science Dictionary (biotech.icmb.utexas.edu/search/dict-search.html), a searchable collection of terms specific to the life sciences. In a search for specialized dictionaries, yourDictionary.com is a good place to start. In addition to its quick reference dictionary and thesaurus, this web site is a resource center for a wide variety of specialty dictionaries in numerous languages. Dictionaries are grouped into categories, including computer, medical, general english. Some dictionary softwares which also used all over world, provide the meaning of a word, pronunciation information, word derivations, histories, or etymologies, illustrations, usage guidance, and examples in sentences. But they are not updatable according to user requirements. In this project we provide a software package that fulfills all above mentioned features. This project is implementing using Java and SQL (Structured Query Language) in the windows operating system. Project Online Dictionary mainly consists of three features. These are 1. a text editor, which take input as text and find incorrect word and provide the possible correct words of the incorrect words. 2. A search for the meaning of the word. 3. Update to update the dictionary database. This will be done off line. Only administrator can do the necessary modification in the dictionary database.

2 Problem Definition
A dictionary is a list of words with their definitions, a list of characters with its glyph or a list of words with corresponding words in other languages. Many dictionaries also provide pronunciation information, word derivations, histories, or etymologies, illustrations, usage guidance, and examples in sentences. To implement all these things in a single dictionary with some new features is the goal of this project.

2.1 Motivation
Our project topic is "Online Dictionary". Therefore we want to use Java servlet technology. The HTTP (Hyper Text Transfer Protocol) that forms the basis of the World Wide Web uses URLs (Uniform Resource Locator) to locate resources on the internet. Common URLs represents files or directories and can represent complex task such as database lookups and internal searches. JavaServer Pages technology is an extension of servlet technology. Servlets commonly are used when a small portion of the content send to the client a static text or markup. In most cases servlet and JSP technologies are interchangeable. The servlets are used to communicate between clients and servers via the HTTP protocol. A client sends and HTTP request to the server. The servlet container receives the request and directs it to be processed by the appropriate servlet. The servlet does its processing, which may include interacting with a database or other server side components such as other servlets. The servlet returns its results to the clientnormally in the form of a HTML, XHTML or XML documents to display in the browser. Using this browser a user can communicate to the dictionary database that is present in the server side program. A user can enter his query here that will retrieve from the database and display the result to the client through the servlet. We are also providing a text editor where a user can edit his required document and save in his computer. In the text editor we will implement "open", "close", "save", copy, paste to do the same to a file. Also we are providing some functions like font style and its sizes, bold, italic, font colours etc. And also there will be an option to check spelling. When some words or sentences are given in the text editor as input then as output it will highlight the incorrect word (i.e. which is not present in 1

the dictionary database). When some words are given in the text editor as input that will read one by one by the getText() function. This can be done using threading where getText() function will read the word after certain time interval and client will send that word to the server where server will check whether the word is present in the dictionary database or not. If match is not found server will call doHighlight() function which is present in the client side and highlight that word. Another important feature of our project is update the dictionary, only administrator can update the dictionary. This updating will be done offline.

3 Overview of Servlets
Servlets are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a servlet might be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company's order database.

Servlets are to servers what applets are to browsers. Unlike applets, however, servlets have no graphical user interface. Servlets can be embedded in many different servers because the servlet API, which you use to write servlets, assumes nothing about the server's environment or protocol. Servlets have become most widely used within HTTP servers; many web servers support the Servlet API.

3.1 Use Servlets instead of CGI Scripts!


Servlets are an effective replacement for CGI scripts. They provide a way to generate dynamic documents that is both easier to write and faster to run. Servlets also address the problem of doing serverside programming with platform-specific APIs: they are developed with the Java Servlet API, a standard Java extension. So use servlets to handle HTTP client requests. For example, have servlets process data POSTed over HTTPS using an HTML form, including purchase order or credit card data. A servlet like this could be part of an order-entry and processing system, working with product and inventory databases, and perhaps an on-line payment system.

3.2 Other Uses for Servlets


Here are a few more of the many applications for servlets. Allowing collaboration between people. A servlet can handle multiple requests concurrently, and can synchronize requests. This allows servlets to support systems such as on-line conferencing.

Forwarding requests. Servlets can forward requests to other servers and servlets. Thus servlets can be
used to balance load among several servers that mirror the same content, and to partition a single logical service over several servers, according to task type or organizational boundaries.

3.3 Architecture of the Servlet Package


The javax.servlet package provides interfaces and classes for writing servlets. The architecture of the package is described below.

3.4 Interface Servlet and the Servlet Life Cycle


All servlets must implement the Servlet interface. As with the key applet methods of interface Servlet are invoked by the servlet container. This interface defines five methods which are given below. Void init (ServletConfig config) The servlet container calls this method once during a servlets execution cycle to initialize the servlet. The ServletConfig argument is supplied by the servlet container that executes the servlet. ServletConfig getServletConfig () This method returns a reference to an object that implements interface ServletConfig. This object provides access to the servlets configuration information such as servlet initialization parameters and the servlets ServletContext, which provides the servlet with access to its environment. String getServletInfo () This method is defined by a servlet programmer to return a string containing servlet information such as the servlets author and version. Void service (ServletRequest request, ServletResponse response) The servlet container calls this method to respond to a client request to the servlet. Void destroy () This cleanup method is called when a servlet is terminated by its servlet container. Resources used by the servlet, such as an open file or an open database connection, should be deallocated here. A servlets life cycle begins when the servlet container loads the servlet into memory-normally, in response to the first request that the servlet receives. Before the servlet can handle that request, the servlet container invokes the servlets init method. After init completes execution, the servlet can respond to its first request. All request are handled by a servlets Service method, which receives the request, processes the request and sends a response to the client. During the servlets life cycle method service is called once per request. Each new request typically requests in a new thread of execution in which method service executes. When the servlet container terminates the servlet, the servlets destroy method is called to release servlet resources. The servlet packages define two abstract classes that implement the interface Servlet-class GenericServlet and class HttpServlet. These classes provide default implementations of all the Servlet methods. Most servlets extend either GenericServlet or HttpServlet and override some or all of their methods.

3.5 HttpServlet Class


Web-based servlets typically extend class HttpServlet. Class HttpServlet overrides method service to distinguish between the typical request received from a client Web browser. The two most common HTTP request types are get and post. A get request gets information from a server. Common uses of get requests are to retrieve an HTML document or an image. A post request posts data to a server. Common uses of post requests typically send information, such as authentication information or data from a form that gathers user input, to a server. Class HttopServlet defines methods doGet and doPost to respond to get and post request from a client, respectively. These methods are called by method service, which is called when a request arrives at the server. Method service first determines the request type, the calls the appropriate method for handling such a request.

3.6 HttpServletRequest Interface


Every call to doGet or doPost for an HttpServlet receives an object that implements interface HttpServletResponse. The web server that executes the servlet creates an HttpServletResponse object and passes it to the servlets service method. This object provides a variety of method that enables the servlet to formulate the response to the client. Some of these methods are from interface ServletResponse-the interface that HttpServletResponse extends. .3.7 HttpServletResponse Interface Every call to doGet or doPost for an HttpServlet receives an object that implements interface HttpServletResponse. The web server that executes the servlet creates an HttpServletResponse object and passes it to the servlets service method. This object provides a variety of method that enables the servlet to formulate the response to the client. Some of these methods are from interface ServletResponse-the interface that HttpServletResponse extends.

4 Java Database Connectivity


JDBC is a Java Database Connectivity API that is a part of the Java Enterprise APIs from Sun Microsystems. Java database connectivity is a set of relational database objects and method for interacting with SQL data sources. How does JDBC work? JDBC is designed on the CLI model. JDBC defines a set of API objects and methods to interact with the underlying database. A java program first opens a connection to a database, makes a statement object, passes SQL statements to the underlying DBMS through the Statement object, and retrieves the results as well as information about the result sets. Typically, the JDBC class files and the java applets reside in the client. They can be downloaded from the network also. To minimize the latency during execution, it is better to have the JDBC classes in the client. The DBMS and the data source are typically located in a remote server. The JDBC classes are in the java.sql package, and all the java programs use the objects and methods in the java.sql package to read from and write to data sources.

4.1 JDBC-ODBC Bridge


A program using the jdbc will need a driver for the data source with which it wants to interface. This driver can be a native module or it can be a java program that talks to a server in the network by using some RPC or an HTTP talker-listener protocol. As a part of JDBC, sun also delivers a driver to access ODBC data source from JDBC. This driver is jointly developed with Inter solve and also is called JDBCODBC bridge. The JDBC-ODBC bridge is implemented as the JdbcOdbc.class and a native library to access the ODBC driver. For Windows platform, the native library is a DLL(JDBCODBC.DLL). In our project we have used com.mysql.jdbc.Driver driver.

4.2 The SQL (Structured Query Language) Language


Structured Query Language (SQL) is a development of an IBM product of the 1970s called Structured English Query Language (SEQUEL). Despite its name, SQL is far more than a simple query tool. In addition to being used to query a database, SQL is used to control the entire functionality of a database system. To support these different functions, SQL can be thought of as a set of the following languages: Data Definition Language (DDL) Data Manipulation Language (DML) Data Query Language (DQL) Data Control Language (DCL)

Unlike Java and most other computer languages, SQL is declarative rather than procedural. In other words, instead of writing a class to perform some task, in SQL issuing a statement that updates a table or returns a group of records.

Data Definition Language


SQL's Data Definition Language (DDL) is used to create and modify a database. In other words, the DDL is concerned with changing the structure of a database. The SQL2 standard refers to DDL statements as SQL Schema Statements and specifies only aspects of the DDL that are independent of the underlying operating system and physical-storage media. In practice, all commercial RDBMS system contains proprietary extensions to handle these aspects of the implementation. The main commands in the DDL are CREATE, ALTER, AND DROP.

Data Manipulation Language


The Data Manipulation Language (DML) is used to insert data into a table and, when necessary, to modify or delete data. SQL provides the three following statements to use to manipulate data within a database: INSERT UPDATE DELETE

Data Query Language


Probably the most important function of any database application is the ability to search for specific records or groups of records and return them in the desired form. In SQL, this capability is provided by the Data Query Language (DQL). The process of finding and returning formatted records is known as query the database.

Data Control Language


The Data Control Language (DCL) provides the tools to manage the database and control such aspects as user-access privileges. Since a database usually represents a significant investment in time and effort, managing users is an aspect of database management. A user is anyone who has access to the database. Users can be granted different privileges, ranging from read-only access to a limited portion of the database, all the way up to unlimited access to the entire RDBMS.

5 Installing a JSP container Jakarta Tomcat


The Jakarta Tomcat servlet engine and JSP container has been chosen for these reasons: Tomcat is the servlet container used in the official reference Implementation for the Java servlet and JavaServer Pager technologies. Tomcat can be downloaded free from the Jakarta Web site, so, with Tomcat, there is no barrier to entry in getting your JSP applications up and running.

Tomcat 5.0.19 is the next generation of Tomcat. The 5.0.19 servlet container has been developed from the ground up for flexibility and performance. Version 5.0.19 implements the final released version of the Servlet 2.3 and JSP 1.2 specifications. As required by the specifications, Tomcat 5.0.19 also supports Web applications build for the Servlet 2.2 and JSP 1.1 specifications with no changes.

5.1 Installation
To unzip and install Tomcat, simply click on the Tomcat zip file, and Winzip opens a dialog box and prompts you to select the install directory and then guides you through the installation. The actual installation takes place in a subdirectory called jacarta-tomcat-5.0.19. We prefer to install Tomcat in its own directory, either directly under C:\ or under Apache, since Tomcat and Apache are designed to work well together.

5.2 Starting and Stopping Tomcat


Tomcat is a Java program, so it is possible to execute it from the command line. However, this involves setting several environment variables. It is easier to use the scripts provided with the Tomcat distribution to start and stop Tomcat. For the average user, the most important scripts are listed in the following table

Script tomcat

startup shutdown

Purpose Sets the environment variables, including CLASSPATH, TOMCAT_HOME and JAVA_HOME, and starts Tomcat with the proper comment-line parameters. Starts tomcat in the back ground Stops tomcat

The most important of these scripts is (tomcat .sh/tomcat.bat). This other scripts serve as a simplified, single task-oriented entry point to the Tomcat script (set different command-line parameters and so on).

5.3 Setting Environment Variables


Before we can use these scripts to start Tomcat, we need to set the following environment variables. TOMCAT_HOME points to the root directory of our Tomcat hierarchy, we should type the following On Win32, type set TOMCAT_HOME= c:\apache\tomcat

JAVA_HOME points to the root directory of our JDK hierarchy, and we should type the following On Win32, type set JAVA_HOME= c:\java\jdk1.4.2

PATH points to the javac executable, we should type the following On Win32, type path=c:\java\jdk1.4.2;%PATH%

CLASSPATH points to the java classes required by Tomcat and we should type the following On Win32, type SET CLASSPATH =.;C:\apache\tomcat\lib\servlet.jar; SET CLASSPATH= %CLASSPATH%;C:\apache\tomcat\lib\jasper.jar; The easiest way to do all this is to create our own script file containing these lines: PATH=C:\JAVA\JDK1.4.2\BIN;%PATH% SET TOMCAT_HOME=C:\APACHE\TOMCAT SET JAVA_HOME=C:\JAVA\JDK1.4.2 SET CLASSPATH =.;C:\apache\tomcat\lib\servlet.jar; SET CLASSPATH= %CLASSPATH%;C:\apache\tomcat\lib\jasper.jar; STARTUP The final command, STARTUP, runs Tomcats own startup.bat script. Save this script as tcstart.bat. Now start Tomcat by typing tcstart.

5.4 Configuring Tomcat to Work with Apache


The Web servers job is to wait for client HTTP request and, when this requests arrives, to do whatever is needed to serve the request by providing the necessary content. Adding a servlet container changes this behavior, adding the need to perform these tasks: Load the servlet container adapter library and initialized it prior to serving request. 7

Check and see if a certain request belongs to a servlet, and, if s o, let Tomcat take the request and handle it. Tomcat needs to know what request it is going to serve, usually based on some pattern in the request URL and where to direct this request

6 Design of Project
As discussed in section 2.1 the design of the project is shown in the following section with the UML/Data flow diagram.

6.1 Implementation decisions and justification


User Query() Servlet/JSP Send data JDBCODBC Bridge Send data SQL Database

Required Result Post query Post query

UML diagram for searching the meaning of the word and checking the spelling

Send User Application Program data JDBCODBC Bridge

Send data SQL Database

UML diagram for updating the database

6.2 Implementation of database


6.2.1 Creating the database
Before we can create table, we need to create a database. This has to be done using the Database Manag-ment System itself, because JDBC requires an existing database to make a connection. DBMS packages that supports a GUI, such as MS Access, SQL Server, Sybase and Oracle, provide a simple graphical way to do this, generally in the form of a wizard, which guides you through the necessary steps. 8

If you are running a common line DBMS such as MySQL, start the package; at the command prompt, type the following: CREATE DATABASE DICTIONARY;

6.2.2 Creating a Table


Tables are created using the CREATE TABLE statement with a table name, followed in parenthesis (()) by a series of column definitions. Heres an example: CREATE TABLE tableName(columnName dataType[constrains], );

6.2.3 Creating a Table using JDBC


The JDBC API is made up off a small number of important classes and interfaces that handle the tasks of loading a suitable driver for your database, connecting to the database, creating and executing a SQL command, and handling any returned records. The primary classes we use for this example are as follows: DriverManager Driver Connection Statement

DriverManager
The DirverManager is responsible for loading JDBC drivers and for returning a connection to the appropriate driver. The DriverManager locates suitable driver for the URL provided in the getConnectin() call by polling the registered drivers.

Driver
The first thing we do is load the com.mysql.jdbc.Driver by name, using class.forName (). Then we register it with the DriverManager, using this command: DriverManager.registerDriver(new JdbcOdbcDriver());

Connection
We next request a connection to the database from the DriverManager using the following command: getConnection(jdbc:driverName:databaseName); The DriverManager polls on registered drivers to find the first one that can create a connection to the URL. Variations on this command let you give the database user name or pass a Java Properties object with the URL: getConnection(String url, String user, String password); getConnection(String url, properties info); A connection represents session with a specific database, providing the context in which our SQL statements are executed and results are returned. In our project we have used com.mysql.jdbc.Driver driver.

Statement
The term Statement refers to the Java class that passes the SQL Query to the database via the connection rather than to the SQL Query itself. A Statement object is used for executing a static SQL statement and obtaining the results it produces.

6.2.4 Deleting or Dropping a Table


Deleting a table with SQL is done using the DROP TABLE command. The DROP TABLE command deletes a table along with all its associated views and indexes. Heres the syntax for the DROP TABLE DROP TABLE table_name To drop the CONTACT_INFO; DROP TABLE CONTACT_INFO;

6.2.5 The INSERT Statement


The basic form of the INSERT statement looks like this: INSERT INTO tableName (colName1, colName2, ) VALUES (value1, value2, ); Follows these rules when inserting data into a table with the INSERT statement: The column names you use must match the names defined for the column. The values you insert must match the data type defined for the column they are being inserted into. You cant, for example put string data into a numeric field. The data you insert into a column must comply with the columns data constrains; for example, you cant put the last names of all numbers of the Corleone family into a column if you have constrained that column as UNIQUE. The data size must not exceed the column width, so you cant put 30 character names into 20 character field.

6.2.6 The UPDATE Statement


A frequent requirement in database application is updating records. For example, when a contact moves, you need to change his or her address. Do this with the SQL UPDATE statement, using a WHERE clause to identify the record you want to change. Heres an example: UPDATE Contact_Info SET Street = 55 Broadway, ZIP = 10006 WHERE First_Name = Michael AND Last_Name = Corleone This statement first evaluate the WHERE clause to find all records First_Name and Last_Name. then it makes the address change to all of those records. In our project we have used an user interface to update the dictionary as shown in the following figure. You can select different kind of dictionary from select dictionary. And you must enter word and its meaning otherwise it will give some errors, and 10

quotation is optional. When you submit the word and its meaning first it check in the database whether the word is present or not, if the word is present it will give an error message word is already resent otherwise it will update the dictionary.

11

6.2.7 Searching the word


As mentioned earlier user can search the word in different category. In our project three types of category present- english, medical and computer. You can search the meaning or details of the word from these category. When you submit the query it will search in the database and retrieved the query and again send to the user.

6.2.8 Spelling Check


As shown in the following JSP through which a user can edit their documents and can save their documents in his computer. When a user uses open and save button that will work according to their meanings. Reset button is used to clear the editable space. And finally submit button is used to check the spelling. When a user entered a word and press space bar JSP will send that word to the database to find the match, if match is not found then flag will set to 1 and highlight that word which means the entered word is wrong. When user enter that wrong word in the Unknown word field and press the submit button then some suggestions will be displayed in the suggestion field.

12

13

7 Conclusion
A dictionary is a list of words with their definitions, a list of characters with its glyph or a list of words with corresponding words in other languages. Our project online dictionaries provide pronunciation information, word derivations, histories, or etymologies, illustrations, usage guidance, and examples in sentences. Dictionaries are grouped into categories, including computer, medical, english. Later we can increase the categories in geology, medicine, physics, rhetoric, publishing, printing, and shipping etc. If any use found any new words they can contact us with the details of that word and they may also send their suggestions.

14

References
[1] John O'Donahue, "Java Database Programming Bible", New Delhi, Wiley Publishing, Inc. [2] Herbert Schildt, "The Complete Reference JAVA 2 Fourth Edition", New Delhi: 110 008, Tata McGraw-Hill. [3] PETER van der LINDEN, "Just JAVA 2 Fourth Edition", Delhi: 110 040, The Sun Microsystems Press. [4] Jamie Jaworski, Java 2 Platform Unleashed, New Delhi:110 002, Techmedia.

15