Sei sulla pagina 1di 98

1.

SYNOPSIS

Record Matching over Query Results from multiple web databases Record matching, which identifies the records that represent the same realworld entity, is an important step for data integration. Most state-of-the-art record matching methods are supervised, which requires the user to provide training data. These methods are not applicable for the Web database scenario, where the records to match are query results dynamically generated on-the-fly. Such records are query-dependent and a prelearned method using training examples from previous query results may fail on the results of a new query. To address the problem of record matching in the Web database scenario, we present an unsupervised, online record matching method, UDD, which, for a given query, can effectively identify duplicates from the query result records of multiple Web databases. After removal of the same-source duplicates, the ??Presumed?? no duplicate records from the same source can be used as training examples alleviating the burden of users having to manually label training examples. Starting from the no duplicate set, we use two cooperating classifiers, a weighted component similarity summing classifier and an SVM classifier, to iteratively identify duplicates in the query results from multiple Web databases. Experimental results show that UDD works well for the Web database scenario where existing supervised methods do not apply.

2. SYSTEM ENVIRONMENT 2.1 HARDWARE REQUIREMENTS Processor Speed DDR RAM Floppy Disk Drive Hard Disk Drive Mouse Monitor Intel Pentium IV 3.00 GHz 512 MB 1.44 MB 80 GB Optical Scroll 17 Color

2.2

SOFTWARE REQUIREMENTS -JAVA -MS Access -Windows XP

Front End Back End Operating System

2.3

SOFTWARE SPECIFICATION

JAVA2

Introduction : In 1990 a handful of developers setout to build a software device that could everyday consumer appliances right from toasters to VCRs. This quest that originated at Sun Micro Systems expanded to include a software that could potentially serve as interface for the internet. The end of 1991 saw the development of an object oriented programming language called Oak. By January 1995, this new Programming language (Oak) had started attracting serious attention from the Internet Community and was renamed Java. The most common Java Programs are applications and standalone programs, such as the Hot Java Browser. These adhere to a set of conventions that lets them run within a Java Compatible browser like Internet Explorer 4. 0. Applets are essentially embedded in HTML pages for web viewing. Write Once, Run Anywhere:Much of Javas attraction lies in its ability to work across platform. A Java program that runs on windows machine will also work on the Macintosh and Unix Operating System. platform cannot run on another. The Java platform is a software platform for delivering and running highly interactive and secure applets and applications on networked computer system. This platform is unique because it has control over other platforms and compiles to byte codes that are machine instructions for a virtual machine and are not specific to any one machine. A program written in the Java language compiles to a byte code file that can run wherever the Java platform is present, on any underlying operating system. To function on an individual

This propery makes Java ideals for the Internet, where one program should be capable of running on any computer in the world. Java Virtual Machine:Java Virutal Machine is a Java Interpreter from the Java soft division of Sun Microsystems. It converts the Java intermediate language(byte code) into machine language a line at a time, and then execute it. Java Development Environment:A Java language development environment includes both the compile time and runtime environments. The Java platform is represented by the runtime environment. The developer writes Java Language source code (Java files) and compiles it to byte code (class file). These byte codes are instructions for the Java Virtual Machine. To create an applet, the developer then stores these byte code files on a HTTP server and adds an <Applet Code=filename>tag to a web page, which names the entry-point byte code file. When you visit the page, the <Applet> tag cause the byte code files to be transposed over the network from the server to your browser in the Java platform. Here, the byte codes are loaded into memory and then verified for security before they enter the virtual Machine. Once in the virtual machine, the byte codes are interpreted by the Interpreter, or have the option to be converted into machine code by the Just-in-time Compiler. The interpreter and JIT compiler operate in the context of the runtime system (threads, memory, other system resources). Any classes from the Java class Libraries (Application Programming interface) are dynamically loaded as needed by the applet.

Programming Components of JAVA: Java Java Applets Java Servlets Java Beans Java Computing Platform -A Computer programming Language -An application that works within the Web browsers. -A Java Program that works on a server. -A development tool provides a platform neutral component Architecture -More than a computing language. It underlies smart cards, consumer electronics and a network computer. Why Java? Basic Features:The features of the Java language that are of particular importance are Simplification Robustness Multithreads Simplification: For any organization with a significant investment in development staff there will be cost saving. Programmers are able to learn Java more quickly and are also become proficient in less time. With a steady stream if few developers join and organization, the ability to get productive as quickly as possible is very important. Robustness:

In a trading-room environment, robust software is absolutely essential. There are a number of features of the Java Language that improve the robustness of programs. For example, Java doesnt expose pointers to the programmer. In conventional language such as C and C++, objects that are dynamically allocated are turned into pointer variables. Not only do pointers allow bugs that can cause memory locations to be accidentally overwritten but it is up to the programmer to ensure that any such dynamically allocated objects are carefully managed and property de-allocated when no longer needed. When these objects are not properly de-allocated, programs fall prey to so-called memory leaks. Such programs can even themselves or the entire system in which they are run. By eliminating pointers, Java completely avoids this problem thereby eliminating, some of the most common problems of software development. At the same time, Java still allows programmers the full flexibility to dynamically allocate objects, it simply takes away many risks that typically accompany pointer-based language. Multithreading: The ability to run several process concurrently, known as Multithreading, is therefore very important. The Java language directly supports multithreading. While multithreading facilities are also available to other programming languages, the fact that the language itself supports the concept means that, in certain cases, it is easier to implement multithreading correctly. For example, in Java a method within an object can be made thread-safe simply adding one keyword to the definition of the method. Platform Independence:

The Java byte code that is generated when an applet is compiled is platform independent. instructions. The byte code is interpreted by the Java virtual machine running within the browser to generate platform-specific This means that an applet can be developed once yet theoretically run anywhere. Internationalization: A key feature of our customer base is that it is global. In order for us to complete effectively in market place where the native language is not English, we have to be able to offer local language versions of our products. This is especially so in the Asian and Eastern European markets where support for character sets such as Kanji, Korean and Cyrillic are demanded. With conventional software developments, the costs to internationalize the products, both in terms of the text making up the user interface as well as the actual data that the user interface displays are high. One of the great advantages of Java is that the basic character set is Unicode. Unicode is an industry-standard character set that encompasses all of the worlds scripts. The use of Unicode in Java help us to produce localized product and services much more cost effectively. Deployment: One of the biggest problems we face is updating our software on these workstation is when we release new products with few features. In some cases we do have the capability of downloading software over the data delivery networks, but often a site visit is required by an engineer, which is expensive.

With Java, the byte code is downloaded from the web server and interpreted by the workstation when the applet is launched on a web page. It doesnt need to be installed on the workstation. Furthermore, each time that applet is retrieved by a user, the user will get the most recent version of the code. This means that new product can be introduced. Java encourage a modular approach to development as opposed to creating large, monolithic applications. If an application is going to be installed on to a workstation, all of the functionality must be contained within the software package at the time of installation Safety: One of the Javas advantage is it inherits security. Because it was create to run application over the Internet, Security against malicious programmers who would be able to build Java applets to reach users machine through the Net to steal passwords, shutdown systems, or other unfortunate heales was the main concern. A Java sandbox, which is a virtual machine designated to block all access to potential danger zones on your computer. Java applets were forced to run in the sandbox. This made Java very safe but also slowed it down making it work less efficiently than native applications that dont require any intermediary processing.

CONCEPTS IN JAVA Objects Oriented Programming

Abstract Data Type: A user defined data type, including its attributes (the data representation of its state) and its methods (its behaviors). Class: Class is the definition of object of the abstract data type. Object: Object is an instance of class. They have state, identity and behavior. Inheritance: Inheritance is the derivation of one class from another so that the attributes and methods of one class are part of the definition of another class. Derived classes are always a kind of their base classes. Polymorphism: In general terms, it means the ability of different classes and object to respond to the same message in different, class-specific ways. Polymorphic methods are those which have one name but different implementations for different class. Interface: Interfaces are Javas substitute for C++s feature of multiple inheritance, the practice of allowing a class to have several super classes. Although it is often desirable to have a class inherited several sets of properties through inheritance, Java class, however can implement several interfaces, thereby enabling you to create classes that build upon other objects without the problems created by multiple inheritance. Input/Output :

Java has a package java.io, which provides different input and output streams for reading and writing data. The input and output streams can be connected to files, network sockets, or internal memory buffers. It also contains stream filters that enable to access stream data in a rarity of different formats. Datainputstream, Some most usable streams in Java are: Inputstream, Fileinputstream, Outputstream, Printstream,

Dataoutputstream, Fileoutputstream, Filterinputstream, Filteroutputstream, Objectinputstream and Objectoutputstream. Communications and Networking Java provides a very powerful and elegant mechanism for creating network client applications allowing to obtain resources from the Internet using java.net.URL class. Java provides classes of TCP/UDP programming using socket. Remote Method Invocation: One of the features that really helps push for forward the client/server model in many streams is known as Remote Procedure Calls (RPC). Since JDK1.1, Java has a similar feature called remote method invocation, which allows to create objects that actually exist and process on machines other than the client computer. Java Development Connectivity(JDC): JDBC is a Java Database Connectivity API that is a part of the Java Enterprise APIs from Sun Microsystems Inc. About Swing: It is a set of relational database objects and methods for interacting with SQL data sources.

Swing is set of classes that provides more powerful and flexible components than are possible with the AWT. Servlet The Servlet Alternative The servlet life cycle allows servlet engines to address both the performance and resource problems of CGI and the security concerns of low-level server API programming. A servlet engine may execute all its servlets in a single Java virtual machine (JVM). Because they are in the same JVM, servlets can efficiently share data with each other, yet they are prevented by the Java language from accessing one another's private data. Servlets may also be allowed to persist between requests as object instances, taking up far less memory than full-fledged processes. Before we proceed too far, you should know that the servlet life cycle is highly flexible. Servers have significant leeway in how they choose to support servlets. The only hard and fast rule is that a servlet engine must conform to the following life cycle contract: 1. Create and initialize the servlet. 2. Handle zero or more service calls from clients. 3. Destroy the servlet and then garbage collect it. It's perfectly legal for a servlet to be loaded, created, and instantiated in its own JVM, only to be destroyed and garbage collected without handling any client requests or after handling just one request. Any servlet engine that makes this a habit, however, probably won't last long on the open market. In this chapter we describe the most common and most sensible life cycle implementations for HTTP servlets. 3.1.1. A Single Java Virtual Machine Most servlet engines want to execute all servlets in a single JVM. Where that JVM itself executes can differ depending on the server, though. With a server written in Java, such as the Java Web Server, the server itself can execute inside a JVM right alongside its servlets.

With a single-process, multithreaded web server written in another language, the JVM can often be embedded inside the server process. Having the JVM be part of the server process maximizes performance because a servlet becomes, in a sense, just another low-level server API extension. Such a server can invoke a servlet with a lightweight context switch and can provide information about requests through direct method invocations. A multiprocess web server (which runs several processes to handle requests) doesn't really have the choice to embed a JVM directly in its process because there is no one process. This kind of server usually runs an external JVM that its processes can share. With this approach, each servlet access involves a heavyweight context switch reminiscent of FastCGI. All the servlets, however, still share the same external process. Fortunately, from the perspective of the servlet (and thus from your perspective, as a servlet author), the server's implementation doesn't really matter because the server always behaves the same way. Instance Persistence We said above that servlets persist between requests as object instances. In other words, at the time the code for a servlet is loaded, the server creates a single class instance. That single instance handles every request made of the servlet. This improves performance in three ways:

It keeps the memory footprint small. It eliminates the object creation overhead that would otherwise be necessary to create a new servlet object. A servlet can be already loaded in a virtual machine when a request comes in, letting it begin executing right away. It enables persistence. A servlet can have already loaded anything it's likely to need during the handling of a request. For example, a database connection can be opened once and used repeatedly thereafter. It can even be used by a group of servlets. Another example is a shopping cart servlet that loads in memory the price list along with information about its recently connected clients. Yet another servlet may choose to cache entire pages of output to save time if it receives the same request again.

Not only do servlets persist between requests, but so do any threads created by servlets. This perhaps isn't useful for the run-of-the-mill servlet, but it

opens up some interesting possibilities. Consider the situation where one background thread performs some calculation while other threads display the latest results. It's quite similar to an animation applet where one thread changes the picture and another one paints the display. A Simple Counter To demonstrate the servlet life cycle, we'll begin with a simple example. Example 3-1 shows a servlet that counts and displays the number of times it has been accessed. For simplicity's sake, it outputs plain text. Example 3-1. A simple counter import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class SimpleCounter extends HttpServlet { int count = 0; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/plain"); PrintWriter out = res.getWriter(); count++; out.println("Since loading, this servlet has been accessed " + count + " times."); } } The code is simple--it just prints and increments the instance variable named count--but it shows the power of persistence. When the server loads this servlet, the server creates a single instance to handle every request made of the servlet. That's why this code can be so simple. The same instance variables exist between invocations and for all invocations. A Simple Synchronized Counter From the servlet-developer's perspective, each client is another thread that calls the servlet via the service(), doGet(), or doPost() methods, as shown in Figure 3-1.[1] [1] Does it seem confusing how one servlet instance can handle multiple requests at the same time? If so, it's probably because when we picture an executing program we often see object instances performing the work, invoking each other's methods and so on. But, although this model works for simple cases, it's not how things actually work. In reality, all real work is done by threads. The object instances are nothing more than data structures

manipulated by the threads. Therefore, if there are two threads running, it's entirely possible that both are using the same object at the same time.

Figure 3-1. Many threads, one servlet instance If your servlets only read from the request, write to the response, and save information in local variables (that is, variables declared within a method), you needn't worry about the interaction among these threads. Once any information is saved in nonlocal variables (that is, variables declared within a class but outside any specific method), however, you must be aware that each of these client threads has the ability to manipulate a servlet's nonlocal variables. Without precautions, this may result in data corruption and inconsistencies. For example, the SimpleCounter servlet makes a false assumption that the counter incrementation and output occur atomically (immediately after one another, uninterrupted). It's possible that if two requests are made to SimpleCounter around the same time, each will print the same value for count. How? Imagine that one thread increments the count and just afterward, before the first thread prints the count, the second thread also increments the count. Each thread will print the same count value, after effectively increasing its value by 2.[2] The order of execution goes something like this [2]Odd factoid: if count were a 64-bit long instead of a 32-bit int, it would be theoretically possible for the increment to be only half performed at the time it is interrupted by another thread. This is because Java uses a 32bit wide stack. count++ // Thread 1 count++ // Thread 2 out.println // Thread 1 out.println // Thread 2

Now, in this case, the inconsistency is obviously not a problem, but many other servlets have more serious opportunities for errors. To prevent these types of problems and the inconsistencies that come with them, we can add one or more synchronized blocks to the code. Anything inside a synchronized block or a synchronized method is guaranteed not to be executed concurrently by another thread. Before any thread begins to execute synchronized code, it must obtain a monitor(lock) on a specified class. If another thread already has that monitor--because it is already executing the same synchronized block or some other block with the same monitor--the first thread must wait. All this is handled by the language itself, so it's very easy to use. Synchronization, however, should be used only when necessary. On some platforms, it requires a fair amount of overhead to obtain the monitor each time a synchronized block is entered. More importantly, during the time one thread is executing synchronized code, the other threads may be blocked waiting for the monitor to be released. For SimpleCounter, we have four options to deal with this potential problem. First, we could add the keyword synchronized to the doGet() signature: public synchronized void doGet(HttpServletRequest req, HttpServletResponse res) This guarantees consistency by synchronizing the entire method, using the servlet class as the monitor. In general, though, this is not the right approach because it means the servlet can handle only one GET request at a time. Our second option is to synchronize just the two lines we want to execute atomically: PrintWriter out = res.getWriter(); synchronized(this) { count++; out.println("Since loading, this servlet has been accessed " + count + " times."); } This approach works better because it limits the amount of time this servlet spends in its synchronized block, while accomplishing the same goal of a consistent count. Of course, for this simple example, it isn't much different than the first option.

Our third option is to create a synchronized block that performs all the work that needs to be done serially, then use the results outside the synchronized block. For our counter servlet, we can increment the count in a synchronized block, save the incremented value to a local variable (a variable declared inside a method), then print the value of the local variable outside the synchronized block: PrintWriter out = res.getWriter(); int local_count; synchronized(this) { local_count = ++count; } out.println("Since loading, this servlet has been accessed " + local_count + " times."); This change shrinks the synchronized block to be as small as possible, while still maintaining a consistent count. Our last option is to decide that we are willing to suffer the consequences of ignoring synchronization issues. Sometimes the consequences are quite acceptable. For this example, ignoring synchronization means that some clients may receive a count that's a bit off. Not a big deal, really. If this servlet were supposed to return unique numbers, however, it would be a different story. Although it's not possible with this example, an option that exists for other servlets is to change instance variables into local variables. Local variables are not available to other threads and thus don't need to be carefully protected from corruption. At the same time, however, local variables are not persistent between requests, so we can't use them to store the persistent state of our counter. 3.1.5. A Holistic Counter Now, the "one instance per servlet" model is a bit of a gloss-over. The truth is that each registered name for a servlet (but not each alias) is associated with one instance of the servlet. The name used to access the servlet determines which instance handles the request. This makes sense because the impression to the client should be that differently named servlets operate independently. The separate instances are also a requirement for servlets that accept initialization parameters, as discussed later in this chapter. Our SimpleCounter example uses the count instance variable to track the number of times it has been accessed. If, instead, it needed to track the

count for all instances (and thus all registered aliases), it can in some cases use a class, or static, variable. These variables are shared across all instances of a class. Example 3-2 demonstrates with a servlet that counts three things: the times it has been accessed, the number of instances created by the server (one per name), and the total times all of them have been accessed. Example 3-2. A more holistic counter import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class HolisticCounter extends HttpServlet { static int classCount = 0; // shared by all instances int count = 0; // separate for each servlet static Hashtable instances = new Hashtable(); // also shared public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/plain"); PrintWriter out = res.getWriter(); count++; out.println("Since loading, this servlet instance has been accessed " + count + " times."); // Keep track of the instance count by putting a reference to this // instance in a Hashtable. Duplicate entries are ignored. // The size() method returns the number of unique instances stored. instances.put(this, this); out.println("There are currently " + instances.size() + " instances."); classCount++; out.println("Across all instances, this servlet class has been " + "accessed " + classCount + " times."); } } This HolisticCounter tracks its own access count with the count instance variable, the shared count with the classCount class variable, and the number of instances with the instances hashtable (another shared resource that must be a class variable). Sample output is shown in

3. SYSTEM ANALYSIS System Analysis is the study of a business problem domain to recommend improvements and specify the business requirements for the solution. Before the hardware for a EDP (Electronic Data Processing) system can be purchased or the program written the requirements of the system have to be investigate the facts gathered and analyzed. This activity is called System Analysis or System Analysis and Design (SAD). 3.1 Existing System: The system used to collect money is difficult. Need to go to the Bank with Passbook and collect the money. The features provided by the existing system is time consuming one. That is, to withdraw the money from Bank makes waiting in the Bank in a Queue after fill the chellan. 3.2 Proposed System : The main aspect of this project is to withdraw , Check the Status and money transfer from our account to another account is very easy.

4. SYSTEM DEVELOPMENT

4.1 Introduction System development is the most important phase of software engineering. There are three distinct approaches to the system development. They are: System Development Life Cycle (SDLC) Structured Analysis Development Method System Prototype Method System Development Life Cycle (SDLC):System Development Life Cycle is a set of activities that analysts, designers and users carry out to develop and implement an information system. There are some activities followed in System Development Life Cycle, Preliminary Investigation Determination of system requirement Design of system Development of software System testing Implementation and evaluation

4.2 Project Description:-

Record matching, which identifies the records that represent the same realworld entity, is an important step for data integration. Most state-of-the-art record matching methods are supervised, which requires the user to provide training data. These methods are not applicable for the Web database scenario, where the records to match are query results dynamically generated on-the-fly. Such records are query-dependent and a prelearned method using training examples from previous query results may fail on the results of a new query. To address the problem of record matching in the Web database scenario, we present an unsupervised, online record matching method, UDD, which, for a given query, can effectively identify duplicates from the query result records of multiple Web databases. After removal of the same-source duplicates, the ??presumed?? nonduplicate records from the same source can be used as training examples alleviating the burden of users having to manually label training examples. Starting from the nonduplicate set, we use two cooperating classifiers, a weighted component similarity summing classifier and an SVM classifier, to iteratively identify duplicates in the query results from multiple Web databases. Experimental results show that UDD works well for the Web database scenario where existing supervised methods do not apply.

5. FUTURE ENHANCEMENT:Search all the web databases Search meta tab Content text and display the details

6. CONCLUSION:-

7. BIBLIOGRAPHY

Java2 The Java HandBook

-Herbert Schildt - Patrick Naughton, Michael Morrison - John Zukowski - James Gosling , Bill Joy, Guy - Gary Cornell, Cay Horstmann

The Java AWT Reference

The Java Language Specification Steele Core Java 1.2

8.3 Screen Layouts

8.4 Source code

import java.io.*; import java.util.Enumeration; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.net.*; import java.util.*;

public class search extends HttpServlet{ //Connection object Connection theConnection; //////private String dbURL = "jdbc:mysql://10.0.0.1/javadevelopers? user=abc&password=abc"; ////private String dbURL = "jdbc:jtds:sqlserver://localhost:1433/tempdb"; private String servletURL="/search";

private String image="/images/open.gif"; public void init() throws ServletException{ makeConnection(); }

public void makeConnection(){ //System.out.println("Opening db connection"); try { //Class.forName("net.sourcefo rge.jtds.jdbc.Driver"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //theConnection = DriverManager.getConnection(dbURL, "sa", ""); theConnection = DriverManager.getConnection("jdbc:odbc:tempdb","sa" ,""); System.out.println("Connected"); } catch (Exception e) { System.out.println(e.getMessage()); } // System.out.println("Connected to the database"); } public void destory(){ try{ theConnection.close(); }catch(Exception e){} } public void service (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { //Get the session object

HttpSession session = req.getSession(true); res.setContentType("text/html"); PrintWriter out = res.getWriter(); writeHead(out); String strSection = req.getParameter("section"); String strCategory = req.getParameter("category"); String strUnder = req.getParameter("under"); String strLink = req.getParameter("link"); String straddnew = req.getParameter("addnew"); String striunder = req.getParameter("iunder"); String strilink = req.getParameter("ilink"); String strserno = req.getParameter("serno"); String modifylink= req.getParameter("modifylink"); String validate= req.getParameter("validate"); String updatemodified = req.getParameter("updatemodified"); String placelinks = req.getParameter("placelinks"); String item= req.getParameter("item");

if ( item!= null) searchitems(out,item); else if ( placelinks != null) placelinks(out); else if (updatemodified!= null) updateModified(out,req); else if (validate!= null)

validateLogin(out,req); else if (modifylink!= null) displayLoginForm(out); else if (strserno != null) displayFinalResult(out,strserno); else if (straddnew != null && striunder != null && strilink!=null) updatenewEntry(out,straddnew,striunder,strilink,req ); else if (strSection != null) displayCategories(out,strSection); else if (strCategory!= null) displayListings(out,strCategory); else if (strUnder!= null) addListings(out,strUnder,strLink); else displaySections(out); writeBottom(out); out.close(); } public void searchitems(PrintWriter pr,String item){ Statement theStatement; ResultSet theResult; pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\"><font color=\"#000080\" size=\"5\">Search results:</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">");

pr.println("<div align=\"center\">"); pr.println("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"91%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\">"); String sql; sql="select url,serno,caption,descp from listings where caption like '%" + item + "%' or descp like '%" + item + "%'"; //sql = "select * from listings where caption like '%" + item + "%' or descp like '%" + item + "%'"; try{ if(theConnection == null) makeConnection(); theStatement=theConnection.createStatement(); theResult=theStatement.executeQuery(sql); int i; i=0; // i=theResult.getFetchSize();

pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<b>"); pr.println("This Page Will Show You The Final Hit.</font>"); pr.println("</b>"); pr.println("</td>"); pr.println("<tr>");

pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<div align=\"center\">"); pr.println("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"91%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\" height=\"1\">"); while(theResult.next()) //Fetch all the records { i++;

pr.println("<tr>"); pr.println("<td width=\"5%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFCC\">" + String.valueOf(i) + "</td>"); pr.println("<td width=\"95%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFCC\"><a href=http://" + theResult.getString(1) + "><font color=\"#CC3300\" size=\"3\">" + theResult.getString(3) + "</font></a></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFF0\"><font color=\"#CC3300\" size=\"4\">&nbsp;</font></td>"); pr.println("<td width=\"95%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFF0\"><font color=\"#000080\" size=\"2\">" + theResult.getString(4) + "</font></td>"); pr.println("</tr>"); }

/*

pr.println("<tr>");

pr.println("<td colspan=2 bgcolor=\"#FFFFF0\"><font color=\"#CC3300\" size=\"4\"><a href=\"" + servletURL + "/search? under=" + strCategory + "\">Add Link</a></font></td>"); pr.println("</tr>"); */ pr.println("</table>"); pr.println("</div>"); pr.println("</td>"); pr.println("</tr>"); theResult.close();//Close the result set theStatement.close();//Close statement }catch (Exception e){ pr.println(e.getMessage()); System.out.println(e.getMessage()); }

} public void placelinks(PrintWriter out){ out.println("<tr>"); out.println("<td width=\"100%\" align=\"center\">"); out.println("<div align=\"center\">"); out.println("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"88%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\" height=\"1\">"); out.println("<tr>");

out.println("<td width=\"100%\" valign=\"top\" height=\"2\" bgcolor=\"#FFFFCC\">"); more specific!</h2>"); out.println("<h2>Please be

out.println("<p>Please find a more specific sub-category for your entry and resubmit your request there.&nbsp;"); out.println("<p>Return to <a href=http://www.java.com" + "\">Java Search</a></p>"); out.println("<p>&nbsp;&nbsp ;"); out.println("</td>"); out.println("</tr>"); out.println("</table>"); out.println("</div>"); out.println("</td>"); out.println("</tr>"); } public void updateModified(PrintWriter out,HttpServletRequest req){ //Get the session object HttpSession session = req.getSession(true); String username = (String) session.getValue ("user"); //out.println(username); String address = req.getParameter("address"); if(address==null) address=""; else address = change(address); String city= req.getParameter("city"); if(city==null) city="";

else city = change(city); String state= req.getParameter("state"); if(state==null) state=""; else state= change(state); String zip= req.getParameter("zip"); if(zip==null) zip=""; else zip= change(zip); String country= req.getParameter("country"); if(country==null) country=""; else country= change(country); String phone= req.getParameter("phone"); if(phone==null) phone=""; else phone= change(phone); String email= req.getParameter("email"); String url= req.getParameter("url"); String caption= req.getParameter("caption"); if(caption==null) caption=""; else caption= change(caption); String description= req.getParameter("description"); if(description==null) description=""; else description= change(description); String mail= req.getParameter("mail"); String sql; sql="update listings set street='" + address + "', city='" + city + "', state='" + state + "', zip='" + zip + "', country='" + country + "', telephone='" + phone + "', email='" + email + "', url='" + url + "', caption='" + caption + "', descp='" + description + "', mailing_list='" + mail + "' where login='" + username + "'"; try{ Statement theStatement; theStatement=theConnection.createStatement(); theStatement.executeUpdate(sql); theStatement.close(); out.println("<tr>");

out.println("<td width=\"100%\" align=\"center\"><font color=\"#FF0000\" size=\"5\">Database successfully updated.</font></td>"); out.println("</tr>"); out.println("<tr>"); }catch(Exception e){} } public void validateLogin(PrintWriter pr,HttpServletRequest req){ String login= req.getParameter("login"); String password = req.getParameter("password"); int serno; serno=0; String s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15, s16; s1=""; s2=""; s3=""; s4=""; s5=""; s6=""; s7=""; s8=""; s9=""; s10=""; s11=""; s12=""; s13=""; s14=""; s15="";

s16=""; try{ Statement theStatement; ResultSet theResultset; theStatement=theConnection.createStatement(); theResultset=theStatement.executeQuery("select * from listings where login='" + login + "' and password='" + password + "'"); while(theResultset.next()){ serno++; //create a session for user HttpSession session = req.getSession(true); session.putValue ("user", login); s1=theResultset.getString(1); s2=theResultset.getString(2); s3=theResultset.getString(3); s4=theResultset.getString(4); s5=theResultset.getString(5); s6=theResultset.getString(6); s7=theResultset.getString(7); s8=theResultset.getString(8); s9=theResultset.getString(9); s10=theResultset.getString(10); s11=theResultset.getString(11); s12=theResultset.getString(12); s13=theResultset.getString(13); s14=theResultset.getString(14); s15=theResultset.getString(15); } theResultset.close(); theStatement.close(); if(serno==0){ pr.println("<tr>");

pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<div align=\"center\">"); pr.println("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"83%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\" height=\"1\">"); pr.println("<tr>"); pr.println("<td width=\"100%\" valign=\"top\" height=\"2\" bgcolor=\"#FFFFCC\">"); pr.println("<form method=\"POST\" action=\"" + servletURL + "/search\">"); pr.println("<input type=hidden name=validate value=1>"); pr.println("<p><br>"); pr.println("<font color=\"#800000\">&nbsp; <font size=\"4\">Invalid user ID or Password! Try again! </font></font><br>"); pr.println("&nbsp;&nbsp; <font color=\"#FF0000\">Login:&nbsp;</font>&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;"); pr.println("<input type=\"text\" name=\"login\" size=\"20\"><br>"); pr.println("&nbsp;&nbsp; <font color=\"#FF0000\">Password:&nbsp;</font>"); pr.println("<input type=\"password\" name=\"password\" size=\"20\"></p>"); pr.println("<p>&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;"); pr.println("<input type=\"submit\" value=\"Submit\" name=\"B1\"></p>");

pr.println("</form>"); pr.println("</td>"); pr.println("</tr>"); pr.println("</table>"); pr.println("</div>"); pr.println("</td>"); pr.println("</tr>"); return; } pr.println("<script language=javascript>"); pr.println("function validate1(){");

pr.println("if(window.document.f2.address.value.len gth==0){"); pr.println("alert (\"Re enter your address.\");"); pr.println("window.document.f2.address.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.city.value.length ==0){"); pr.println("alert (\"Re enter your city.\");"); pr.println("window.document.f2.city.focus();"); pr.println("return false;");

pr.println("}");

pr.println("if(window.document.f2.state.value.lengt h==0){"); pr.println("alert (\"Re enter your state.\");"); pr.println("window.document.f2.state.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.country.value.len gth==0){"); pr.println("alert (\"Re enter your country.\");"); pr.println("window.document.f2.country.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.email.value.lengt h==0){"); pr.println("alert (\"Re enter your email.\");"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}");

pr.println("//

FOR EMAIL ");

pr.println("if(window.document.f2.email.value.lengt h)"); pr.println("{ var Ename = document.f2.email.value = document.f2.email.value.toLowerCase();"); pr.println("var sLength = Ename.length;"); pr.println("//Validate the login name"); pr.println("if (isWhitespace(Ename))"); pr.println("{"); pr.println("alert (\"You can't leave this field blank\")"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("else if ( ! isCharsInBag( Ename, \"abcdefghijklmnopqrstuvwxyz01 23456789.-_@\" ))"); pr.println("{"); pr.println("alert( \"Email ID may only contain the following characters:\\nabcdefghijklmnopqrstuvwxyz0123456789. -_@\" );"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("else if ( ! isCharsInBag( Ename.charAt(Ename.length 1), \"abcdefghijklmnopqrstuvwxyz0123456789\") )"); pr.println("{"); pr.println("alert( \"Email ID must end in an alphanumeric character.\");");

pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("else if ( ! isCharsInBag( Ename.charAt(0), \"abcdefghijklmnopqr stuvwxyz0123456789\") )"); pr.println("{"); pr.println("alert( \"Email ID must start with an alphanumeric character.\");"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); 3 )"); pr.println("else if ( Ename.length <

pr.println("{"); pr.println("alert( \"Email ID must be 3 or more characters.\" );"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("// look for @"); pr.println("else if (Ename.indexOf(\"@\") == -1)"); pr.println("{"); pr.println("alert(\"Your Email ID must contain @ sign\") "); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("// look for ."); pr.println("else if (Ename.indexOf(\".\") == -1)"); pr.println("{");

pr.println("alert(\"Your Email ID must contain . sign\")"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("// return true;"); pr.println("}"); pr.println("////EMAIL");

pr.println("if(window.document.f2.url.value.length= =0 || window.document.f2.url.value==\"http://\") {"); pr.println("alert (\"Re enter your web url.\");"); pr.println("window.document.f2.url.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.caption.value.len gth==0){"); pr.println("alert (\"Re enter caption of your page.\");"); pr.println("window.document.f2.caption.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.description.value .length==0){"); pr.println("alert (\"Re enter description.\");"); pr.println("window.document.f2.description.focus(); "); pr.println("return false;"); pr.println("}"); pr.println("return true;"); pr.println("}"); pr.println("</script>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\"><font color=\"#000080\" size=\"5\">Modify Your Link</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<table border=\"0\" width=\"95%\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFDB\">"); pr.println("<form name=\"f2\" method=\"post\" action=\"" + servletURL + "/search\" onsubmit=\"return validate1();\">"); pr.println("<input type=\"hidden\" name=\"updatemodified\" value=Y>");

pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\">&nbsp;&nbsp;&nbsp;</td>"); pr.println("<td width=\"89%\">&nbsp;&nbsp;&nbsp;</td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Address<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><textarea rows=\"4\" name=\"address\" cols=\"22\" maxlength=200>" + s4 + "</textarea></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>City<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"city\" size=\"20\" maxlength=30 value=\"" + s5 + "\" ></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>State<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"state\" size=\"20\" maxlength=30 value=\"" + s6 + "\"></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Zip</b></td>");

pr.println("<td width=\"89%\"><input type=\"text\" name=\"zip\" size=\"20\" maxlength=10 value=\"" + s7 + "\"></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Country<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"country\" size=\"20\" maxlength=30 value=\"" + s8 + "\"></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Phone</b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"phone\" size=\"20\" maxlength=30 value=\"" + s9 + "\"></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>E-mail<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"email\" size=\"20\" maxlength=50 value=\"" + s10 + "\"></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>URL<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"url\" size=\"20\" value=\"" + s11 + "\" maxlength=100 > </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Caption<font color=\"#FF0000\">*</font></b></td>");

pr.println("<td width=\"89%\"><input type=\"text\" name=\"caption\" size=\"20\" maxlength=100 value=\"" + s13 + "\"> </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Description<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"description\" size=\"35\" maxlength=\"200\" value=\"" + s14 + "\"> </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Add me to mailing list</b></td>"); pr.println("<td width=\"89%\"><input type=\"checkbox\" name=\"mail\" value=\"Y\" checked> </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\">&nbsp;&nbsp;</td>"); pr.println("<td width=\"89%\">&nbsp;&nbsp; </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"133%\" colspan=\"3\" align=\"center\"><input type=\"submit\" value=\"Submit\" name=\"B1\">&nbsp;"); pr.println("<input type=\"reset\" value=\"Reset\" name=\"B2\"></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\">&nbsp;</td>"); pr.println("<td width=\"89%\">&nbsp;&nbsp;&nbsp; </td>");

pr.println("</tr>"); pr.println("</table>");

}catch(Exception e){}

} public void displayLoginForm(PrintWriter out){ out.println("<tr>"); out.println("<td width=\"100%\" align=\"center\">"); out.println("<div align=\"center\">"); out.println("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"83%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\" height=\"1\">"); out.println("<tr>"); out.println("<td width=\"100%\" valign=\"top\" height=\"2\" bgcolor=\"#FFFFCC\">"); out.println("<form method=\"POST\" action=\"" + servletURL + "/search\">"); out.println("<input type=hidden name=validate value=1>"); out.println("<p><br>"); out.println("<font color=\"#800000\">&nbsp; <font size=\"4\">Please login to modify your listings.</font></font><br>"); out.println("&nbsp;&nbsp; <font color=\"#FF0000\">Login:&nbsp;</font>&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;");

out.println("<input type=\"text\" name=\"login\" size=\"20\"><br>"); out.println("&nbsp;&nbsp; <font color=\"#FF0000\">Password:&nbsp;</font>"); out.println("<input type=\"password\" name=\"password\" size=\"20\"></p>"); out.println("<p>&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;"); out.println("<input type=\"submit\" value=\"Submit\" name=\"B1\"></p>"); out.println("</form>"); out.println("</td>"); out.println("</tr>"); out.println("</table>"); out.println("</div>"); out.println("</td>"); out.println("</tr>"); } public void updatenewEntry(PrintWriter out,String straddnew,String striunder,String strilink,HttpServletRequest req){ int serno; serno=1; try{ String strregid = req.getParameter("regid"); //////// if(strregid==null) strregid=""; //////// else strregid = change(strregid);

Statement theStatement; ResultSet theResultset; ////////theStatement=theConnection.createStatem ent(); ////////theResultset=theStatement.executeQuery( "select * from listings where login='" + strregid + "'"); //////// while(theResultset.next()){ //////// out.println("<tr>"); //////// out.println("<td width=\"100%\" align=\"center\"><font color=\"#FF0000\" size=\"5\">Registration ID already exists! Please hit your browsers back button and select another Registration ID.</font></td>"); //////// out.println("</tr>"); //////// out.println("<tr>"); //////// return; //////// } ////////theResultset.close(); ////////theStatement.close();

theStatement=theConnection.createStatement(); theResultset=theStatement.executeQuery("select max(serno) from listings"); while(theResultset.next()){ serno=theResultset.getInt(1)+1; } theResultset.close(); theStatement.close(); String password = req.getParameter("pass1"); if(password==null) password="";

else password = change(password); String address = req.getParameter("address"); if(address==null) address=""; else address = change(address); String city= req.getParameter("city"); if(city==null) city=""; else city = change(city); String state= req.getParameter("state"); if(state==null) state=""; else state= change(state); String zip= req.getParameter("zip"); if(zip==null) zip=""; else zip= change(zip); String country= req.getParameter("country"); if(country==null) country=""; else country= change(country); String phone= req.getParameter("phone"); if(phone==null) phone=""; else phone= change(phone); String email= req.getParameter("email"); String url= req.getParameter("url"); String category= req.getParameter("iunder"); String caption= req.getParameter("caption"); if(caption==null) caption=""; else caption= change(caption); String description= req.getParameter("description"); if(description==null) description=""; else description= change(description); String mail= req.getParameter("mail");

String s; java.text.Format formatter; java.util.Date date = new java.util.Date(); formatter = new java.text.SimpleDateFormat("MM/dd/yy"); s = formatter.format(date); //sysDateStr = new java.text.SimpleDateFormat("dd-mm-yy").format(d1); //String sql="insert into listings values('" + String.valueOf(serno) + "','" + strregid + "','" + password + "','" + address + "','" + city + "','" + state + "','" + zip + "','" + country + "','" + phone + "','" + email + "','" + url + "','" + category + "','" + caption + "','" + description + "','" + mail + "',now())"; String sql = "insert into listings values('" + String.valueOf(serno) + "','" + strregid + "','" + password + "','" + address + "','" + city + "','" + state + "','" + zip + "','" + country + "','" + phone + "','" + email + "','" + url + "','" + category + "','" + caption + "','" + description + "','" + mail + "'," + s + ")"; System.out.println(sql); theStatement=theConnection.createStatement(); theStatement.executeUpdate(sql); theStatement.close(); out.println("<tr>"); out.println("<td width=\"100%\" align=\"center\"><font color=\"#000080\" size=\"5\">Thank you for adding your link.</font></td>"); out.println("</tr>"); out.println("<tr>"); } catch(Exception e){

out.println("<tr>"); out.println("<td width=\"100%\" align=\"center\"><font color=\"#FF0000\" size=\"5\">" + e.getMessage() + "</font></td>"); System.out.println(e.getMessage()); out.println("</tr>"); out.println("<tr>"); }

//out.println("Adding new Entry");

} public String change(String String st; st=""; StringTokenizer t=new StringTokenizer(str,"'"); if(str==null) { st=""; } else { int i =t.countTokens(); while(t.hasMoreTokens()){ if(st.compareTo("")==0) st=t.nextToken(); else st=st + "\\'" + t.nextToken(); } str){

} return st; } //Displays the form, which allows to add new entry. public void addListings(PrintWriter pr,String strUnder,String strLink){ pr.println("<script language=javascript>"); pr.println("function validate1(){"); pr.println("if(window.document.f2.regid.value.lengt h==0){"); pr.println("alert (\"Please enter a login.\");"); pr.println("window.document.f2.regid.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.pass1.value.lengt h==0){"); pr.println("alert (\"Please enter your password.\");"); pr.println("window.document.f2.pass1.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.pass2.value.lengt h==0){"); pr.println("alert (\"Re enter your password.\");"); pr.println("window.document.f2.pass2.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.pass2.value ! = window.document.f2.pass1.value){"); pr.println("alert (\"Password does not match. Re-enter password!\");"); pr.println("window.document.f2.pass1.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.address.value.len gth==0){"); pr.println("alert (\"Re enter your address.\");"); pr.println("window.document.f2.address.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.city.value.length ==0){");

city.\");");

pr.println("alert (\"Re enter your

pr.println("window.document.f2.city.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.state.value.lengt h==0){"); pr.println("alert (\"Re enter your state.\");"); pr.println("window.document.f2.state.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.country.value.len gth==0){"); pr.println("alert (\"Re enter your country.\");"); pr.println("window.document.f2.country.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.email.value.lengt h==0){"); pr.println("alert (\"Re enter your email.\");"); pr.println("window.document.f2.email.focus();");

pr.println("return false;"); pr.println("}");

pr.println("//

FOR EMAIL ");

pr.println("if(window.document.f2.email.value.lengt h)"); pr.println("{ var Ename = document.f2.email.value = document.f2.email.value.toLowerCase();"); pr.println("var sLength = Ename.length;"); pr.println("//Validate the login name"); pr.println("if (isWhitespace(Ename))"); pr.println("{"); pr.println("alert (\"You can't leave this field blank\")"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("else if ( ! isCharsInBag( Ename, \"abcdefghijklmnopqrstuvwxyz01 23456789.-_@\" ))"); pr.println("{"); pr.println("alert( \"Email ID may only contain the following characters:\\nabcdefghijklmnopqrstuvwxyz0123456789. -_@\" );"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}");

pr.println("else if ( ! isCharsInBag( Ename.charAt(Ename.length 1), \"abcdefghijklmnopqrstuvwxyz0123456789\") )"); pr.println("{"); pr.println("alert( \"Email ID must end in an alphanumeric character.\");"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("else if ( ! isCharsInBag( Ename.charAt(0), \"abcdefghijklmnopqr stuvwxyz0123456789\") )"); pr.println("{"); pr.println("alert( \"Email ID must start with an alphanumeric character.\");"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); 3 )"); pr.println("else if ( Ename.length <

pr.println("{"); pr.println("alert( \"Email ID must be 3 or more characters.\" );"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("// look for @"); pr.println("else if (Ename.indexOf(\"@\") == -1)"); pr.println("{"); pr.println("alert(\"Your Email ID must contain @ sign\") "); pr.println("window.document.f2.email.focus();");

pr.println("return false;"); pr.println("}"); pr.println("// look for ."); pr.println("else if (Ename.indexOf(\".\") == -1)"); pr.println("{"); pr.println("alert(\"Your Email ID must contain . sign\")"); pr.println("window.document.f2.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("// return true;"); pr.println("}"); pr.println("////EMAIL");

pr.println("if(window.document.f2.url.value.length= =0 \"){"); pr.println("alert (\"Re enter your web url.\");"); pr.println("window.document.f2.url.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.caption.value.len gth==0){"); pr.println("alert (\"Re enter caption of your page.\");");

pr.println("window.document.f2.caption.focus();"); pr.println("return false;"); pr.println("}");

pr.println("if(window.document.f2.description.value .length==0){"); pr.println("alert (\"Re enter description.\");"); pr.println("window.document.f2.description.focus(); "); pr.println("return false;"); pr.println("}"); pr.println("return true;"); pr.println("}"); pr.println("</script>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\"><font color=\"#000080\" size=\"5\">Place Your Link</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<table border=\"0\" width=\"95%\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFDB\">");

pr.println("<form name=\"f2\" method=\"post\" action=\"" + servletURL + "/search\" onsubmit=\"return validate1();\">"); pr.println("<input type=\"hidden\" name=\"addnew\" value=Y>"); pr.println("<input type=\"hidden\" name=\"iunder\" value=" + strUnder + ">"); pr.println("<input type=\"hidden\" name=\"ilink\" value=" + strLink + ">");

pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\">&nbsp;&nbsp;&nbsp;</td>"); pr.println("<td width=\"89%\">&nbsp;&nbsp;&nbsp;</td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Select Registration ID<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"regid\" size=\"20\" maxlength=15></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Enter Password<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"password\" name=\"pass1\" size=\"20\" maxlength=15></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>");

pr.println("<td width=\"39%\"><b>Re -Enter Password<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"password\" name=\"pass2\" size=\"20\" maxlength=15></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Address<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><textarea rows=\"4\" name=\"address\" cols=\"22\" maxlength=200></textarea></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>City<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"city\" size=\"20\" maxlength=30></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>State<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"state\" size=\"20\" maxlength=30></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Zip</b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"zip\" size=\"20\" maxlength=10></td>"); pr.println("</tr>"); pr.println("<tr>");

pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Country<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"country\" size=\"20\" maxlength=30></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Phone</b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"phone\" size=\"20\" maxlength=30></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>E-mail<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"email\" size=\"20\" maxlength=50></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>URL<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"url\" size=\"20\" value=\"\" maxlength=100> </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Caption<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"caption\" size=\"20\" maxlength=100> </td>"); pr.println("</tr>"); pr.println("<tr>");

pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Description<font color=\"#FF0000\">*</font></b></td>"); pr.println("<td width=\"89%\"><input type=\"text\" name=\"description\" size=\"35\" maxlength=\"200\"> </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\"><b>Add me to mailing list</b></td>"); pr.println("<td width=\"89%\"><input type=\"checkbox\" name=\"mail\" value=\"Y\" checked> </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\">&nbsp;&nbsp;</td>"); pr.println("<td width=\"89%\">&nbsp;&nbsp; </td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"133%\" colspan=\"3\" align=\"center\"><input type=\"submit\" value=\"Submit\" name=\"B1\">&nbsp;"); pr.println("<input type=\"reset\" value=\"Reset\" name=\"B2\"></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\">&nbsp;</td>"); pr.println("<td width=\"39%\">&nbsp;</td>"); pr.println("<td width=\"89%\">&nbsp;&nbsp;&nbsp; </td>"); pr.println("</tr>"); pr.println("</table>");

}//end of addListings

public void displayFinalResult(PrintWriter pr,String strserno){ Statement theStatement; ResultSet theResult; pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\"><font color=\"#000080\" size=\"5\">Search results:</font></td>"); pr.println("</tr>"); String sql; sql="select * from listings where serno=" + strserno; try{ if(theConnection == null) makeConnection(); theStatement=theConnection.createStatement(); theResult=theStatement.executeQuery(sql); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<b>"); pr.println("This Page Will Show You The Final Hit.</font>"); pr.println("</b>"); pr.println("</td>"); pr.println("</tr>");

records

while(theResult.next()) //Fetch all the {

pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<div align=\"center\">"); pr.println("<table border=\"2\" cellpadding=\"0\" cellspacing=\"1\" width=\"91%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\" height=\"1\">"); pr.println("<tr>"); pr.println("<td width=\"100%\" valign=\"top\" height=\"1\" bgcolor=\"#000066\" align=\"center\"><font size=\"4\" color=\"#FFFFFF\">" + theResult.getString(13) + "</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFF0\"><b><font color=\"#000080\">Description:<br>"); pr.println("</font></b>&quo t;" + theResult.getString(14) + "&quot;<br>"); pr.println("&nbsp;&nbsp;<br >"); pr.println("<font color=\"#000080\"><b>Contact</b></font><font color=\"#000080\"><b>"); pr.println("Address:<br>"); pr.println("</b></font><fon t face=\"Arial\" size=\"2\">" + theResult.getString(4) + "<br>"); pr.println(theResult.getStr ing(5) + "<br>"); pr.println(theResult.getStr ing(6) + "<br>"); pr.println(theResult.getStr ing(7) + "<br>");

ing(8) + "<br>");

pr.println(theResult.getStr

pr.println("&nbsp;<br>"); pr.println("<font color=\"#008000\">Tel:&nbsp;</font> " + theResult.getString(9) + "<br>"); String em; em=theResult.getString(10); pr.println("<font color=\"#008000\">Email:</font> <a href=\"mailto:" + em + "\">" + em + "<br>"); pr.println("</a><font color=\"#008000\">Web: </font><a href=\"" + theResult.getString(11) + "\">Visit at our web site.</a>&nbsp;<br>"); pr.println("&nbsp;&nbsp;&nb sp;</font></td>"); pr.println("</tr>"); pr.println("</table>"); pr.println("</div>"); pr.println("</td>"); pr.println("</tr>"); } theResult.close();//Close the result theStatement.close();//Close statement }catch (Exception e){ pr.println(e.getMessage()); }

set

} //displays add links

public void displayListings(PrintWriter pr,String strCategory){ Statement theStatement; ResultSet theResult; pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\"><font color=\"#000080\" size=\"5\">Search results:</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<div align=\"center\">"); pr.println("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"91%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\">"); String sql; sql="select serno,caption,descp from listings where category=" + strCategory; try{ if(theConnection == null) makeConnection(); theStatement=theConnection.createStatement(); theResult=theStatement.executeQuery(sql); int i; i=0; // i=theResult.getFetchSize(); pr.println("<tr>");

pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<b>"); pr.println("This Page Will Show You The Final Hit.</font>"); pr.println("</b>"); pr.println("</td>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<div align=\"center\">"); pr.println("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"91%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\" height=\"1\">"); while(theResult.next()) //Fetch all the records { i++;

pr.println("<tr>"); pr.println("<td width=\"5%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFCC\">" + String.valueOf(i) + "</td>"); pr.println("<td width=\"95%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFCC\"><a href=\"" + servletURL + "/search?serno=" + theResult.getString(1) + "\"><font color=\"#CC3300\" size=\"3\">" + theResult.getString(2) + "</font></a></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"5%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFF0\"><font color=\"#CC3300\" size=\"4\">&nbsp;</font></td>");

pr.println("<td width=\"95%\" valign=\"top\" height=\"1\" bgcolor=\"#FFFFF0\"><font color=\"#000080\" size=\"2\">" + theResult.getString(3) + "</font></td>"); pr.println("</tr>"); }

pr.println("<tr>"); pr.println("<td colspan=2 bgcolor=\"#FFFFF0\"><font color=\"#CC3300\" size=\"4\"><a href=\"" + servletURL + "/search? under=" + strCategory + "\">Add Link</a></font></td>"); pr.println("</tr>"); pr.println("</table>"); pr.println("</div>"); pr.println("</td>"); pr.println("</tr>"); theResult.close();//Close the result theStatement.close();//Close statement }catch (Exception e){ pr.println(e.getMessage()); }

set

}//end of displayListings public void displayCategories(PrintWriter pr,String strSection){ Statement theStatement;

ResultSet theResult;

pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\"><font color=\"#000080\" size=\"5\">Categories</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<div align=\"center\">"); pr.println("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"91%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\">"); String sql; sql="select serno,description from categories where section_code=" + strSection; try{ if(theConnection == null) makeConnection(); theStatement=theConnection.createStatement(); theResult=theStatement.executeQuery(sql); while(theResult.next()) //Fetch all the records { pr.println("<tr>"); pr.println("<td width=\"7%\" valign=\"top\" height=\"1\"><font face=\"arial\" size=\"3\"><b><small><img border=\"0\" src=\"" + image + "\" width=\"24\" height=\"24\"></small></b></font></td>");

pr.println("<td width=\"42%\" valign=\"top\" height=\"1\"><font face=\"arial\" size=\"3\"><a href=\"" + servletURL + "/search? category=" + String.valueOf(theResult.getInt(1)) + "\">" + theResult.getString(2)+ "</a></font></td>"); if(theResult.next()){ pr.println("<td width=\"7%\" valign=\"top\" height=\"1\"><font face=\"arial\" size=\"3\"><b><small><img border=\"0\" src=\""+ image +"\" width=\"24\" height=\"24\"></small></b></font></td>"); pr.println("<td width=\"44%\" valign=\"top\" height=\"1\"><font face=\"arial\" size=\"3\"><a href=\"" + servletURL + "/search? category=" + theResult.getString(1) + "\">" + theResult.getString(2)+ "</a></font></td>"); }else{ pr.println("<td width=\"7%\" valign=\"top\" height=\"1\">&nbsp;</td>"); pr.println("<td width=\"44%\" valign=\"top\" height=\"1\">&nbsp;</td>"); } pr.println("</tr>"); } set theResult.close();//Close the result

theStatement.close();//Close statement }catch (Exception e){ pr.println(e.getMessage()); } }

public void displaySections(PrintWriter pr){ Statement theStatement; ResultSet theResult; pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\"><font color=\"#000080\" size=\"5\">Sections</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<div align=\"center\">"); pr.println("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"91%\" bgcolor=\"#FFFFFF\" bordercolor=\"#C6FFFF\">"); String sql; sql="select * from section"; try{ if(theConnection == null) makeConnection(); theStatement=theConnection.createStatement(); theResult=theStatement.executeQuery(sql); while(theResult.next()) //Fetch all the records { pr.println("<tr>"); pr.println("<td width=\"50%\" valign=\"top\"><small><font face=\"arial\" size=\"3\"><a href=\"" + servletURL + "/search? section=" + theResult.getString(1) + "\"><b>" + theResult.getString(2) + "</b></a></font></small><font face=\"arial\" size=\"2\"><br>");

pr.println(theResult.getStr ing(3) + "</font></td>"); if(theResult.next()){ pr.println("<td width=\"50%\" valign=\"top\"><small><font face=\"arial\" size=\"3\"><a href=\"" + servletURL + "/search?section=" + theResult.getString(1) + "\"><b>" + theResult.getString(2) + "</b></a></font></small><font face=\"arial\" size=\"2\"><br>"); pr.println(theResult.getString(3) + "</font></td>"); } else pr.println("<td width=\"50%\" valign=\"top\">&nbsp;</td>"); pr.println("</tr>"); } set theResult.close();//Close the result

theStatement.close();//Close statement }catch (Exception e){ pr.println(e.getMessage()); }

public void writeHead(PrintWriter pr){ pr.println("<html>"); pr.println("<head>"); pr.println("<title>Welcome to Java Developers paradise!</title>"); pr.println("<meta content=\"Welcome to Java Developers paradise! We are totally devoted to Java server side , servlets, JSP, JDBC, EJB, XML,MySql\"name=\"description\">");

pr.println("<meta content=\"JAVA, JSP, Servlets, Servlet, Search Engine, Directory, Jserv, Apache, JDBC, EJB, programming, developer, news, intranet, internet, Web, http, cgi alternatives, jdbc servlets, links, help\"name=\"keywords\">"); pr.println("<script language=javascript>"); pr.println("var whitespace=\"/t/n/r\""); pr.println("function isEmpty(s)"); pr.println("{ return "); pr.println("((s == null) || (s.length == 0))"); pr.println("}"); pr.println("function isWhitespace (s)"); pr.println("{ var i;"); pr.println(" // Is s empty?"); pr.println("if (isEmpty(s)) "); pr.println("return true;"); pr.println("// Search through string's characters one by one"); pr.println("// until we find a nonwhitespace character."); pr.println(" // When we do, return false; if we don't, return true."); pr.println("for (i = 0; i < s.length; i+ +)"); pr.println("{ "); pr.println("// Check that current character isn't whitespace."); pr.println("var c = s.charAt(i);"); pr.println("if (whitespace.indexOf(c) == -1)"); pr.println("return false;"); pr.println("}");

pr.println("// All characters are whitespace."); pr.println(" return true;"); pr.println("}"); pr.println("function isCharsInBag (s, bag)"); pr.println("{ "); pr.println("var i;"); pr.println("// Search through string's characters one by one."); pr.println("// If character is in bag, append to returnString."); pr.println("for (i = 0; i < s.length; i++)"); pr.println("{ "); pr.println("// Check that current character isn't whitespace."); pr.println("var c = s.charAt(i);"); pr.println("if (bag.indexOf(c) == -1) return false;"); pr.println("}"); pr.println("return true;"); pr.println("}");

pr.println("function validate(){"); pr.println("if(window.document.f1.name.value.length ==0){"); pr.println("alert(\"Please enter your name\");"); pr.println("window.document.f1.name.focus();"); pr.println("return false;"); pr.println("}"); pr.println("if(window.document.f1.email.value.lengt h==0){"); pr.println("alert(\"Please enter your email\");");

pr.println("window.document.f1.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("// FOR EMAIL ");

pr.println("if(window.document.f1.email.value.lengt h)"); pr.println("{ var Ename = document.f1.email.value = document.f1.email.value.toLowerCase();"); pr.println("var sLength = Ename.length;"); pr.println("//Validate the login name"); pr.println("if (isWhitespace(Ename))"); pr.println("{"); pr.println("alert (\"You can't leave this field blank\")"); pr.println("window.document.f1.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("else if ( ! isCharsInBag( Ename, \"abcdefghijklmnopqrstuvwxyz01 23456789.-_@\" ))"); pr.println("{"); pr.println("alert( \"Email ID may only contain the following characters:\\nabcdefghijklmnopqrstuvwxyz0123456789. -_@\" );"); pr.println("window.document.f1.email.focus();"); pr.println("return false;"); pr.println("}");

pr.println("else if ( ! isCharsInBag( Ename.charAt(Ename.length 1), \"abcdefghijklmnopqrstuvwxyz0123456789\") )"); pr.println("{"); pr.println("alert( \"Email ID must end in an alphanumeric character.\");"); pr.println("window.document.f1.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("else if ( ! isCharsInBag( Ename.charAt(0), \"abcdefghijklmnopqr stuvwxyz0123456789\") )"); pr.println("{"); pr.println("alert( \"Email ID must start with an alphanumeric character.\");"); pr.println("window.document.f1.email.focus();"); pr.println("return false;"); pr.println("}"); 3 )"); pr.println("else if ( Ename.length <

pr.println("{"); pr.println("alert( \"Email ID must be 3 or more characters.\" );"); pr.println("window.document.f1.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("// look for @"); pr.println("else if (Ename.indexOf(\"@\") == -1)"); pr.println("{"); pr.println("alert(\"Your Email ID must contain @ sign\") "); pr.println(" window.document.f1.email.focus();");

pr.println("return false;"); pr.println("}"); pr.println("// look for ."); pr.println("else if (Ename.indexOf(\".\") == -1)"); pr.println("{"); pr.println("alert(\"Your Email ID must contain . sign\")"); pr.println("window.document.f1.email.focus();"); pr.println("return false;"); pr.println("}"); pr.println("// return true;"); pr.println("}"); pr.println("return true;"); pr.println("}"); pr.println("</script>"); pr.println("</head>"); pr.println("<body bgcolor=\"#c6ffff\">"); pr.println("<div align=\"center\">"); pr.println("<center>"); pr.println("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"99%\">"); pr.println("<tr>"); pr.println("<td width=\"100%\" colspan=\"2\" bgcolor=\"#FFCCFF\"><a href=http://localhost:8080/><img border=\"0\" src=\"http://localhost:8080//images/paradise.gif\" width=\"420\" height=\"60\" alt=\"Welcome to Java Developers Paradise\"></a>"); pr.println("</td>"); pr.println("</tr>");

pr.println("<tr>"); pr.println("<td width=\"23%\" valign=\"top\">"); pr.println("<div align=\"center\">"); pr.println("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"99%\" bordercolor=\"#FFFF00\">"); pr.println("<tr>"); pr.println("<td width=\"100%\" bgcolor=\"#FFFFFF\">"); pr.println("<p align=\"center\"><font color=\"#000080\" size=\"3\">Features</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\">"); pr.println("<p align=\"center\"><font color=\"#FF0000\" face=\"Times New Roman\" size=\"4\">Have tutorials? </font><font size=\"1\"><br> </font><a href=\"http://download.oracle.com/javase/tutorial\" ><font size=\"2\">Add your tutorial to our Java Resource and get tons of hits.</font></a><font size=\"2\"><br>We offer <b>free hosting</b> for your tutorials. and exposure for thousands of readers. drop a mail</font><font face=\"MS Sans serif\" size=\"-2\"><a href=\"mailto:adam@vitalspark.co.in\"><font color=\"maroon\"><br>adam@vitalspark.co.in<br></fon t></a>&nbsp;&nbsp;&nbsp;"); pr.println(" </font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\" bgcolor=\"#FFFFFF\">"); pr.println("<font color=\"#000080\" size=\"3\">Search Options</font></td>"); pr.println("</tr>"); pr.println("<tr>");

pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<form method=\"POST\" action=\"" + servletURL + "/search\">"); pr.println("<p><input type=\"text\" name=\"item\" size=\"20\"><br>"); pr.println("<input type=\"submit\" value=\"Search\" name=\"B1\"></p>"); pr.println("</form>"); pr.println("</td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\" bgcolor=\"#FFFFFF\">"); pr.println("<p align=\"center\"><font color=\"#000080\" size=\"3\">Link Options</font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" align=\"center\">"); pr.println("<font color=\"#000080\" size=\"2\"><a href=http://www.javazoom.net/links/links.html> Place Links </a></font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" bgcolor=\"#FFCCFF\" align=\"center\">"); pr.println("<p align=\"center\"><a href=\"http://www.jsptut.com\" style=\"color: #800000\"><font face=\"Times New Roman\" color=\"#800000\" size=\"2\">Java Server Pages</font></a>"); pr.println("</td>"); pr.println("</tr>"); pr.println("<tr>");

pr.println("<td width=\"100%\" bgcolor=\"#FFCCFF\" align=\"center\">"); pr.println("<p align=\"center\"><a style=\"color: #800000\" href=\"http://download.oracle.com/javase/1.3/docs/g uide/rmi/getstart.doc.html\"><font face=\"Times New Roman\" color=\"#800000\" size=\"2\">RMI</font></a>"); pr.println("</p>"); pr.println("</td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" bgcolor=\"#FFCCFF\" align=\"center\">"); pr.println("<p align=\"center\"><a style=\"color: #800000\" href=\"http://download.oracle.com/javase/tutorial/j avabeans/index.html\"><font face=\"Times New Roman\" color=\"#800000\" size=\"2\">Java Beans</font></a>"); pr.println("</td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" bgcolor=\"#FFCCFF\" align=\"center\">"); pr.println("<p align=\"center\"><a style=\"color: #800000\" href=\"http://www.jdbctutorial.com\"><font face=\"Times New Roman\" color=\"#800000\" size=\"2\">JDBC</font></a>"); pr.println("</p>"); pr.println("</td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" bgcolor=\"#FFCCFF\" align=\"center\">"); pr.println("<p align=\"center\"><a style=\"color: #800000\"

href=\"http://www.mysqltutorial.org\"><font face=\"Times New Roman\" color=\"#800000\" size=\"2\">MySQL</font></a>"); pr.println("</p>"); pr.println("</td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\" bgcolor=\"#FFCCFF\" align=\"center\">"); pr.println("<p align=\"center\"><a style=\"color: #800000\" href=\"http://java.sun.com/developer/onlineTraining /Servlets/Fundamentals\"><font face=\"Times New Roman\" color=\"#800000\" size=\"2\">Java Servlets</font></a>"); pr.println("</td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\">"); //////// pr.println("<form name=\"f1\" method=\"post\" action=\"http://localhost:8080//subscription/subscr ibe.php3\" onsubmit=\"return validate()\">"); //////// pr.println("<P align=center><font color=\"#FF0000\" size=\"3\">Join Now For Free</font><FONT size=4 color=\"#000080\"></FONT><font color=\"#800000\"> <font size=\"2\"> Weekly newsletter about latest in java.&nbsp;<br>"); //////// pr.println("Your Name</font> <input type=\"text\" name=\"name\" size=\"20\"><br>"); //////// pr.println("<font size=\"2\">Your Email&nbsp;<br></font></font><INPUT id=text2 size=13 name=email><br><INPUT align=absMiddle alt=Join border=0 name=I2 src=\"http://localhost:8080//images/blue_submit.gif

\" type=image value=Join width=\"94\" height=\"26\" ></P>"); ////////pr.println("</form>"); pr.println("</td>"); pr.println("</tr>"); pr.println("</table>"); pr.println("</div>"); pr.println("</td>"); pr.println("<td width=\"77%\" valign=\"top\">"); pr.println("<div align=\"center\">"); pr.println("<center>"); pr.println("<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">"); pr.println("<tr>"); pr.println("<td width=\"100%\" bgcolor=\"#FFFFFF\"><font size=\"3\"></font></td>"); pr.println("</tr>"); pr.println("<tr>"); pr.println("<td width=\"100%\">&nbsp;&nbsp;&nbsp;</td>"); pr.println("</tr>"); }

public void writeBottom(PrintWriter pr){ pr.println("</table>"); pr.println("</div>"); pr.println("</td>"); pr.println("</tr>"); pr.println("</table>"); pr.println("</center>"); pr.println("</div>");

pr.println("</td>"); pr.println("</tr>"); pr.println("</table>"); pr.println("</center>"); pr.println("</div>"); pr.println("</p>"); pr.println("<p>&nbsp;</p>"); pr.println("</body>"); pr.println("</html>"); }

} } }

Potrebbero piacerti anche