Vous êtes sur la page 1sur 153

A

Training Report On ON LINE SHOPPING in partial fulfillment of the requirement for the award of the degree of Master of Computer Application Of Uttar Pradesh Technical University, Lucknow By Please write your name (your university roll number) Batch:-2001-04

Apeejay Institute of Technology


School of Computer Science Gamma Sector, Greater Noida (U.P.) - 201308

June 2004

INDEX - ON LINE SHOPPING Chapter Scheme :1. Acknowledgement 2. Certificate of Originality 3. Brief about the organization R.M Infotech(P) Ltd. 4.Introduction to the Problem 5.Introduction to Project. 6. Purpose. 7. Objective. 8. Contribution of Project 9 Hardware Software Used . About Java. . About Oracle. 10. Analysis. . My Role . Module Description . Methology . Table Description. . Flow Diagram. 11. Problem Definition . Exiting system . Proposed system . Feasibility Study . Request Approval . Optimization . Validation Checks . PERT . GANNT . Object of the proposed 12. Bibliography 13. Screens 14. Demo Code.

ACKNOWLEDGEMENT

I EXPRESS MY DEEP SENSE OF GRATITUDE TO MY PROJECT SUPERVISOR MR. ANURAG MEHROTRA FOR HIS EXPERT GUIDANCE, STIMULATING DISCUSSIONS AS WELL AS CONTINUED IMPETUS THROUGHOUT THE PERIOD OF THIS PROJECT. I ALSO EXPRESS MY SINCERE THANKS TO MR. GAURAV & MR. VENKATESH PROJECT LEADERS OF R.M INFOTECHFOR THEIR ENCOURAGING SOLICITED ADVICE AND ALL KIND OF HELP EXTENDED DURING THE PERIOD OF THIS PROJECT. I ALSO EXPRESS MY INTIMATE THANKS TO MY FRIENDS FOR PROVIDING ENOUGH ZEALOUS AND A GOOD DEAL OF HELP. LAST BUT NOT THE LEAST, I AM THANKFUL TO MY ALL OTHER WELL WISHERS FOR THEIR VALUABLE AND PRECIOUS HELP DURING THIS PROJECT. FINALLY I AM THANKFUL TO ALL THOSE PEOPLE WHO ARE DERECTLY OR INDIRECTLY RELATED WITH THIS PROJECT.

PROJECT

ON LINE SHOPPING Modules :1. Seller Administration. 2. Buyer Administration. BY :

PLATFORM USED:WINDOWS NT. FRONT END:HTML, DHTML, FRONT PAGE 98 BACK END:ORACLE 8i ENTERPRISE EDITION MIDDLE WARE :EJB, JAVA SERVLETS, JDBC, RMI. SERVER :JAVA WEB SERVER 2.0/ WEBLOGIC5.0

To, Vikas Sakalle Enrollment No : 0120CA021032 Scope Engineering College Bhopal, M.P. INDIA From :R.M Infotech (P) Ltd. H-24, Sector 27. Noida, U.P. INDIA Subject : Appointment as Project Trainee. In response to your letter, we are happy to inform you that you are considered as a Project trainee in our organization , to work on real time project under the guidance of Mr Bipin Pandey. Job responsibility includes development and maintenance of project tile On Line Shopping for client Micro Data Products (P) Ltd.

Thank you.

For R.M Infotech (P) Ltd.

(H. R. Manager).

Certificate of originality
This is to certify that the project titled On Line Shopping has been completed by Mr. Manoj, Enrolment No.00 (U.P Tech University ) under my guidance and supervision during the period from 15th Jan. 2003 to 5th June 2003. and has not been submitted earlier whether to U.P Tech University to any other institution for partial fulfillment of the requirement for the degree of master in Computer Applications (MCA).

Signature of the student Date:

Signature of the Guide Date:

COMPANY PROFILE A QUALITY SOLUTION COMPANY This is the era of Information Technology. Its significance is vital in our lives because it presents infinite opportunities for growth and development, all this through Internet. A key ingredient for the Internet to be successful is state-of-art net infrastructure to converge different media and sources with integral knowledge and clear concept is very essential. This has been the main motivation for our launching R.M INFOTECHas an intensive unit of Training and Development center. About Net Horizon R.M INFOTECHPVT. LTD. is a leading company in providing quality solutions in the IT industry. It is an information, training and complete solution providing company bringing high quality services to the clientele. It is proud to have a satisfied clientele of leading Corporate business houses. We are professionally managed company with a vision and mission to provide completes IT solutions to the entrepreneurs. A harmonious combination of man and machine in which man gets precedence over the machine. DEVELOPMENT-CENTER: R.M Infotech aims at providing complete and Quality Solution to its clients in all spheres of IT activities. Strategic tie-ups with IBM, Compaq, Hewlett-Packard, SUN Microsystems, HCL, Acer, MICROSOFT, Computer Associates, Cisco, 3Com, Nortal Networks, AMP, Mod-Tap and AT&T with a team of highly qualified professionals are the strong points of the organization. Quality being the hallmark of the organization, R.M Infotech provides tailored solution and takes on turnkey projects.

OUR CREDENTIALS AS A TRAINING CENTER: R.M Infotech with its standard facility at NOIDA with air-conditioned premises of 300 sq. ft., is custom designed with essential infrastructure to accommodate six batches prospectively with twelve students in each batch per day i.e. seventy students per day subsequently. The organization enables trainees to use the potential of technology through experienced IT professionals. We have a staff strength of six senior developers with BE & MCA background and having experience in development of minimum two years. The Lab-Room is equipped with heavily configured ten P.C. connected through network and loaded with all latest software like c# (sharp), EJB and Oracle 8i. The center is also equipped with backup facility in case of electricity failure. OUR VISION : We shall define ourselves in the cutting edge technology in the coming era. We shall create honest working environment with see-through-glass planning. OUR MISSION : To create opportunity for growth & self actualization to trainees and provide An environment of highly conducive works culture.

TECHNICAL STRUCTURE : For Web Site : Front End HTML. DHTML Flash Photoshop Java Script Added features : a) b) c) d) e) Connectivity through JDBC - Thin Driver i.e. Oracle Driver. Chat Server - Applet & Servlet communication with RMI. Java Mail Server. Java Search Engine. Uploadation using File Transfer Protocol (FTP). Middle Tier JSDK 2.0 JSP EJB RDBMS Oracle8i Server JWS 2.0 Tom Cat. Weblogic5.1

For Application : Front End VC++ Visual Basic RDBMS Oracle8i Operating System Windows NT

PARTIAL LIST OF OUR ESTEEMED CLIENTS NOKIA INDIA (P) LTD. COSMIC INFOTECH SOLUTIONS (CITeS) HONKONG AND SHANGHAI BANKING CORPORATION (HDFC) exl SERVICE.COM NET2.TRAVELS.COM CELMANIA.COM POLAROID INDIA LTD. PERFETTI INDIA LTD. GLOBAL NETCOM SERVICES PVT. LTD. EBONY AVON BEAUTY PRODUCTS INDIA PVT. LTD. ADEPTIA INDIA PVT. LTD. CALTEXT LUBRICANTS INDIA PVT. LTD. COSMO FERRITES LTD. TRISOFT DESIGN SHRIRAM AUTOMOTIVE PRODUCTS LTD. NIKSUN INDIA PVT. LTD. ISPAT INDUSTRIES LTD. OSWAL CHEMICALS & FERTILIZERS LTD. MINISTRY OF TEXTILES MINISTRY OF ENVIRONMENT S.R.C.C. SAIL MODI ENTERTAINMENT NETWORK RAJYASABHA APTECH COMPUTER EDUCATION LTD. ZEE INTERACTIVE LEARNING SYSTEMS LTD. EL-ZEE TELEVISION LTD. SAHARA INDIA PARIVAR. DCM INDUSTRIES LTD. JALDI.COM NOBLE & HEWITT BEETAL FINANCIAL SERVICES LTD. TRICON RESTAURANTS INTERNATIONALS. REEBOK INDIA COMPANY

D.R.D.O. AUTOMAX LTD. MMTC LIMITED BANK OF NOVA SCOTIA. HDM INDIA LTD. ELOFIC INDUSTRIES LTD. NIKSUN INDIA PVT. LTD. REDIFFUSION DY & R BRAND COMMUNICATIONS. SATYA SONS ARMY GOLF COURSE HUNTER DOUGLAS MILITARY HOSPITAL COSMIC INFOTECH SOLUTIONS BIRLA TECHNICAL SERVICES SPECTRUM MAGAZIES LTD. INDOMAG STEELS JAMIA MILIA ISLAMIC UNIVERSITY MODICARE HOLIDAY INN MUMBAI HILTI INDIA RAJDOOT PAINTS HYDERABAD INDUSTRIES AVL SOFTWARE (P) LTD. JAIPRAKASH INDUSTRIES LTD. CRM DIVISION OF TISCO SOME OF THE WEB PROJECTS UNDERTAKEN Company AZ DATAMALL MA ASSOCIATES DP ASSOCIATES POLARIS CHEVRON SRF Ltd. RK BERI FINEDGE CREMICA FOODS LTD. RAMA PAPERS URL www.dwebonline.com www.ma-associates.com www.dp-associates.org www.bankwareindia.com www.chevronhotels.com www.srf-limited.com www.rkberiandsons.com www.finedgetech.com www.Cremicafoods.com www.ramapapers.com

MICRO DATA PRODUCTS LTD. CENTRE POINT HOTEL GULMOHUR SCHOOL VASANT VIHAR CHURCH YOUNG ADVERTISE JSOFT KIRAN SOCIETY

www.microdataproducts.com www.centerpointhotel.com www.gulmohurschool.com www.stdominicchurch.org www.youngadds.com www.onlineexam.com www.matritva.com

Introduction to Project
Title of Project U.R.L Client Status Team Size Duration Server name Server Space Server Location : : : : : : : : : On Line Shopping. www.microdataproduct.com Micro Data Product (P) Ltd. Banglore, India. Uploadtion and Maintenance in process One Team Member. 500 600 hrs project. Windows NT Server 20 MB. K. V. Creative, 11901, Hobby Horse Court, 1313 Austin, Texas 78758, U.S.A. Phone : 001-512-8211962 E-mail : host@kvcindia.com.

Promotion of the site : Site will be promoted through various means(1) Through personal approach by marketing division (2) Through telemarketing (3) Through advertisement in various newspaper Maintenance Brief Description : This site is acting as a middle men connecting Seller and Buyer. Both has to register themselves by paying a minimum amount of Rs. 500/which will remain valid for one year. After registration a seller has to register its product. Similarly Buyer can log on to site and search for a product and can do shopping. : The site will be maintained by R.M Infotechusing FTP Protocol.

Project Category This project is a Business to Consumer , E-Commerce web-site. There is difference between Web-site and a Portal. Example of Portal is like Yahoo, Rediff and Indiatimes where as examples of Web-site is like bazee, delhihotels, jobsahead etc. Portal is general in nature and has many objectives to accomplish where as Website is specific in nature and has only one objective to accomplish hence our project is a website and not a portal. Second feature of this project is that it is a B2C ECommerce site which means that on line money transaction is taking place between consumer and Business house. This is an On Line Shopping Web Site on which person can log in and can register himself and can search for products. Objective of this project is complete automation and globalization of Placement Process. We have used J2EE as Middle Ware Logic and Oracle as a backend database. This is a era of Information Technology where getting information is the base of each and every thing. Success of any business depends upon its popularity and goodwill. Today market has been expanded and you have to be a global player , today client want to access most of the information from his residence and then do transaction. World Wide Web i.e. Internet technology is the fastest medium to access the information today. You can access any kind of information from this technology. By registering a URL in World Wide Web you make your self Global i.e. then any person from any part of world can have access to your information.

To summarize over all we can say that Category of this project is :Web-Site. E-Com i.e transaction on net. Business to Consumer. Virtual Auction site. Both users can use search engine to search for a product PURPOSE: Computerized On Line Shopping system is developed to facilitate the general administration system to manage the various information and the processes so, that organization can access accurate information quickly and easily as and when required, thereby improving its operational efficiency & effectiveness. Why is the topic chosen: In todays competitive environment, where everybody wants to be on the top, Information plays very crucial role. As fast as information is accessed and processed, it can give good results. Internet help to fulfill these goals. It will help in easy storage and access of all information, in short period of time.

Objective :Computerized Shopping System is developed to facilitate the general administration system to manage the various information of the Product sale and purchase and the processes involved in a Shopping. So, that organization can access accurate information quickly and easily as and when required, thereby improving its operational efficiency & effectiveness In todays competitive environment, where everybody wants to be on the top, Information plays very crucial role. As fast as information is accessed and processed, it can give good results. Today Internet is the fast way of transferring Data and Information over wide area, hence I have used internet as a way for exchanging information. Computerized system help to fulfill these goals. Computerization of the official works will help in doing lot of manual work quickly. It will help in easy storage and access of all information, in short period of time. On Line Shopping System is developed to facilitate the general administration system to manage the various information of the Seller , Buyer and the processes involved in a Shopping. So, that organization can access accurate information quickly and easily as and when required, thereby improving its operational efficiency & effectiveness.

Objective of the site:

(i) The objective of the Shopping site is to capture the Global market. (ii) The objective of the Shopping site is to provide automated information in a globalize form. (iii) (iv) (v) (vi) (vii) Features of the site: (i) It has the features of providing all the information online (through the net). About the product for Shopping. (ii) The Shopping site is a special purpose site. Make Product Information available to all. Assure Reasonable Price for product. Quality Product at reasonable price. Easier Transaction with transparency. Increase Business on Net.

(iii) The site includes the Chat Messenger which provides the users to interact with each other online. (iv) The site includes the search engine and advance search engine which gives the user easy way to find the product which he/she can purchase. (v) The site also includes the electronic mail facility for the users who have registered themselves. (vi) The site has the registration fee Rs. 500 which prevents the unregistered user to bid a product.

(vii) The site acts as a middle-ware for the seller and the buyer. (viii) The site has the facility to inform the seller and buyer about the final sale.

What contribution would the Project make: The project would help in effective and systematic record keeping that is storing and retrieving of useful data. Project will be able to give the report so that management can make decisions on the basis of those reports. Scope of the study: The main Scope of study: It should contain all the information of Seller who is registering his product. It should contain all the information of Product like Product id, Category, Sale Price etc. It should process and evaluate purchase made by buyers. It should contain information of Sale Price etc. It should contain information related to Product expiry or re registration. It should inform both buyer and Seller when the product is sold. It should maintain proper financial records. It should have Administrator for scheduling administrative work of site. It should contain all the information of company. It should contain all the information of the products, which is produced by the company with their quality. It should contain all the information of the money transactions. It should contain the facility of ordering the products through e-mail or Fax. It should contain facility of on line shopping either through credit card or through bank.

Clients Name :The company Micro Data Product (P) Ltd. is one of the leading manufacturers and exporters of Micro Processors , Modem , Sound Card, Fax Machine etc.. It supplies these items to Middle-East countries, Singapore and other Western countries. This site is made to globalize product and to increase both buyers and sellers hence increasing the business of client. There requirement was to prepare a web site which can do manual things i.e. computerization of manual job. Some of the clients requirements are: Clients Requirements :According to the Objectives we can specifically analyze the clients requirements which are as under : (a) To make Indian Product global, (b) To Globalize Indian market. (c) To have competitive price of product. (d) To assure good price of a product. (e) To act as middle man and connect two parties i.e. Buyer and Seller. (f) To help in making effective transaction. (g) To increase his own business. (h) To generate revenue by transaction.

About the System: The whole system is divided into different module:Module 1: Registration module, which is further sub-divided into two subsections: 1) Company Registration 2) User Registration. Module 2: Administration section, which is further sub-divided into three sub- sections: 1) Login 2) Forget Password 3) Change Password Module 3: Maintaining Company section, which is further sub-divided into three sub-sections: 1) Product Registration. 2) Product Updation. 3) Company Status. Module 4: Maintaining User section, which is further sub-divided into three sub-sections: 1) Search Engine. 2) Order Registration. 3) Order Updation. 4) User Status.

Site Working :1. Person can register as a Seller or Buyer but if one person wants to be both Seller and Buyer he has to register him self twice first as a seller and then as a Buyer with two user id. 2. This is a Paid Site where person has to pay registration amount . Registration will remain valid for one year. 3. At the time of log in his status will be checked i.e. He is log in as Seller or Buyer. Case A He is Log in as a Seller.

4. If person is Seller he can register his product , or update his product or can check the status of his product i.e. How many purchases have been made, what is the total sale price etc. 5. At the time of Product Registration Seller has to specify Market price and other information of product. 6. If the product is already sold then Seller can not update his product. 7. At the Time of Product Registration Seller has to pay 2% of market price as a security.

Case B

He is Log in as Buyer.

8. If he is buyer he can search for product of his choice, search engine will display product information of the product; Buyer can choose the product of his choice and make a bid. 9. After choosing products his shopping cart will be displayed showing total number of purchases. He can make updation to his shopping cart. 10. If he makes order his order will be booked and an order id will be generated. 11.Buyer can update his Order. 12.Buyer can check status of his purchase.

Flow Diagram - Logical

Enter UserId Enter Password New Company Sign up ---- B New User Sign up ------ C Forget Password ------ D Change Password ---- E

Login---A

Submit

Comp Regist. Form.

Check UserId

If doesnot Exist in D.B.

If Exist in D.B. Back to Comp. Regis. Form

Bank Form (cr-card infor)

Message:you are registered

* Note :- Same Architecture is adopted for User Sign up ---- C


E D Change Password Form Forgetpass1
UserId Enter Old UserId Enter Old Password Enter New Password

Check UserI d

If Not Member Else

If Member Select Secret Ques ForgetPass-2


Your Secret Ques is . Enter Secret Ans

Else

Check Old Passw ord and New Passw If Match ord., Chec k Old UserI d and Passw ord from D.B. If there in D.B.

Check Secret Ans If Correct Ans.

If Not Correct Ans. Message : Your Password has been changed to

Message : your password is..

A Check Memb er If Member Check Status

F Company Intro Form If Not Member <Register Product> <Update Product> <My Status> Case-G

User

Case-F
Company .

Product Registration Form.

Update Product Form

Bank Form

Message : Product Updated

Message : Product registered.

Company Status Form Receives all information about registered products...

User Introduction Form <Search Product> <Update Order> <My Status> Product Order Form Search Engine

Bank Form

Message : Order Recived Update Order Form

Message :Order Updated

User Status Form : Recives all information regarding order placed by user

Tables Structure:
1. Company Registration Table

Field Name Comp_id Comp_name Comp_pwd Comp_category Comp_address Telp_no E-Mail

Primary Key

Type varchar2(25) varchar2(25) varchar2(10) varchar2(10) varchar2(10) number(10) varchar2(10)

2. User Registration Table. Field name user_id password First name Last Name Street_add State Country Zip fax Tel E_mail Sec_q Sec_a Date_of_reg Pay_mode Status Primary Key Type varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(250) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) date varchar2(25) varchar2(25)

3. Product Master Table Field name Product_id Product_Category 4. Automobile Field Name Item_id Product_id Item_name User_id Market_price First_sec_hand Location Description Vehicle_type Brand_name Vechicle_no Reg_no Average Colour Model Fuel_type Type number(25) number(10) varchar2(30) varchar2(25) varchar2(25) varchar2(15) varchar2(30) varchar2(125) varchar2(20) varchar2(20) varchar2(20) varchar2(20) varchar2(10) varchar2(20) varchar2(20) varchar2(15) Primary Key Type varchar2(25) varchar2(10)

Primary Key Foreign Key Foreign Key

5.Arts_antiques Field Name Item_id Product_id Item_name User_id Market_price First_sec_hand Primary Key Foreign Key Foreign Key Type number(25) number(10) varchar2(30) varchar2(25) varchar2(25) varchar2(15)

Location Year Description 6. Books Field Name Item_id User_id Product_id Market_price First_sec_hand Location Description Category Author Title Publisher Language Qty Primary Key Foreign Key Foreign Key

varchar2(30) varchar2(10) varchar2(125)

Type varchar2(25) varchar2(25) number(10) varchar2(25) varchar2(15) varchar2(30) varchar2(125) varchar2(25) varchar2(25) varchar2(35) varchar2(30) varchar2(20) varchar2(25)

7. Computer Field Name Item_id Item_name Product_id User_id Market_price First_sec_hand Location Description Category Brand_name config Qty Primary Key Foreign Key Foreign Key Type number(25) varchar2(30) number(10) varchar2(25) varchar2(25) varchar2(15) varchar2(30) varchar2(125) varchar2(30) varchar2(30) varchar2(50) varchar2(25)

8. electronics

Field Name Item_id Item_name User_id Product_id Market_price First_sec_hand Location Description Category Brand_name Qty

Primary Key Foreign Key Foreign Key

Type number(25) varchar(30) varchar2(25) number(10) varchar2(25) varchar2(15) varchar2(30) varchar2(125) varchar2(30) varchar2(30) varchar2(25)

9 Furniture Field name Item_id Product_id Item_name User_id Market_price First_sec_hand Location Description Type Brand_name Quantity Primary Key Foreign Key Foreign Key Type varchar(25) number(10) varchar2(30) varchar2(25) varchar2(25) varchar2(15) varchar2(30) varchar2(125) varchar2(35) varchar2(35) varchar2(20)

10 property_tab Field name Item_id Product_id Market_price First_sec_hand User_id Description Location Primary Key Foreign Key Foreign Key Type number(25) number(10) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25)

Type Area Comm_noncomm Security 11 garments_ tab Field name Item_id Product_id Market_price First_sec_hand User_id Description Location Type Cloth_type Garment_size Brand_name Color Design_nondesign Quantity Primary Key Foreign Key Foreign Key

varchar2(25) varchar2(25) varchar2(25) varchar2(25)

Type number(25) number(10) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25) varchar2(25)

12 buyer Field name user_id Comp_id Item_id Product_id Item_name Description Market_price Primary Key Foreign Key Foreign Key Foreign Key Type varchar2(25) varchar2(25) varchar2(25) number(10) varchar2(25) varchar2(25) varchar2(25)

Forms to be Generated: 1. Company Registration Form.

2. User Registration Form. 3. Login Form. 4. Change Password Form. 5. Forget Password Form. 6. Product Registration Form. 7. Product Updation Form. 8. Company Status Form. 9. Product Search Form. 10.Add To Cart Form. 11.Product Order Form. 12.Order Update Form. 13.User Status. 14.arts.html 15.autombl.html 16.books.html 17.category_from.html 18.ch_pwd.html 19.computer.html 20.c_items.html 21.electronics.html 22.forg.html 23.furniture.html 24.garments.html 25.indprod.html 26.property.html 27.search1.html 28.update_prd.html Servlets to be used: 1. adv_search.java 2. aml_serv.java 3. animal_up.java 4. antiques.java 5. antiques_up.java 6. auto_serv.java 7. auto_up.java 8. bid.java 9. bookfrm.java 10.books_up.java

11.b_status.java 12.celeb_up.java 13.cel_serv.java 14.change.java 15.chg_status.java 16.comp.java 17.compu_up.java 18.elect_up.java 19.elec_serv.java 20.forget.java 21.furniture_up.java 22.fur_serv.java 23.garfrm.java 24.gar_up.java 25.indfrm.java 26.ind_up.java 27.jewels.java 28.jewel_up.java 29.login.java 30.option.java 31.propfrm.java 32.prop_up.java 33.search.java 34.servreg.java 35.update_prod.java 36.v_status.java

Project Category:-

Category of this project is RDBMS based MVC model 2 , N-tier architecture, Distributed Environment based project with server side component. Project can be categorized in two ways :1. Local area network projects.

2. Distributed Projects. Local Area Network projects are those projects where application has to be incorporated in the Local area network of the client i.e within its premises only. In LAN case server is not remotely located and client access this application through this network. Here the question of platform independence does not arise and we use technologies like : Visual Basic , Fox pro , D2k or C,C++. Distributed projects are those projects where application is remotely situated. In these kinds of projects application is remotely situated on to the remote server from where client machine access this application. WAN and an Internet is a kind of distributed application where client machine connects to the remote server and application is downloaded on to client machine. Here the question of platform independence arises and we use technologies like Java Servlets , Java Server Pages , EJB , RMI etc.

Project Models :

There are three kind of Project models :1. Single tier architecture. 2. Two tier architecture. 3. N- tier architecture. Single tier Architecture: - In this kind of architecture Database and Client Application remains on One machine i.e. there is no client server technology, there is no centralization of database and basically it is a stand alone system. Two tier Architecture: - In this Kind of architecture Database and client application is on two different machine i.e. Database on one machine and Application on another machine. In this type of architecture there is client server technology and centralization of data base is there, but it has two demerits:1. Security is not there, 2. Multiple Client access is not there. N- tier Architecture :- In this kind of architecture there is a middle ware in between client and database. Middle ware checks the validity of the client i.e. weather client can access the database or not. Hence there is security in it as well as middle ware allows multiple client access. What is Middle Ware? Middle Ware is a concept, Middle Ware provides centralization of business logic i.e. instead of putting logic on each and every client machine we put logic on a centralized server hence middle ware is nothing but a server side program where all your business logic and business methods reside. It remains on server side and it has all the logical building. Middle ware provides:1. Multiple Client access. 2. Centralized business logic in case of distributed application. MVC Model II

In MVC model project is divided into three layers :View which is an client interface to interact with client and generate dynamic information. We can use both Swings and Servlet to design client application code.
a)

Client Side Interface :In client side interface we are using : Application. Swings In WAN Application. Servlet / JSP In Internet

Based

Swings components are platform independent components and we are designing client side forms using Swings and we are calling EJB (Server side business logic) on event. Servlets / JSP are middleware technologies which are used in web based projects because they use :1. HTTP Protocol to handle Request and Response. 2. They are invoked through Browser. 3. They give out put in HTML format. 4. They need Browser Support. We have designed web based forms using servlets and servlets call EJB in which we have defined business logic. b) Controller - Controller contain business logic, we have used Enterprise Java Beans 1.2 to design sever side component which can be called from both Desk top application and Web based application.

EJB: - EJB is a server side component in which we define business logic which is reusable. Features of EJB are:-

1. Wider Scope i.e. it can be used in both application based projects and web based projects. 2. Reusability. 3. Economical and efficient. 4. Connection Pool. 5. Transaction and Persistency. 6. Security. 7. Multi threading. Model Model is a storage device in which we store data we have used Oracle 8i as Model.
c)

Data base is the most important thing in this universe as data base gives identity to a thing without data base existence of a thing is impossible. While working on a project first step is to design a database. What is data base ? Data Base is a collection of tables and table is a collection of records in a tabular form i.e. in row and columns. Data Base can be divided into two parts :1. RDBMS. 2. DBMS. We will be using RDBMS (Relational Database Management System) in our project i.e. oracle 8i Enterprise edition.

Why we are using Oracle (RDBMS)? Some of the merits of using Oracle (RDBMS) is as under :-

Centralization of database. Client Server Technology. Security. Normalization of Data Base. Relationship. Transaction Processor. It gives some internet related features.

Hence because of these features we are using Oracle as a back end technology.

>>>>>>>>>>>>>>>>>>>>>>>>>>>> TOOLS/PLATFORMS LANGUAGES DEVELOPMENT OF THE PROJECT

USED

FOR

THE

(A) Java 2.0 - ENTERPRISE EDITION (Business Logic)


The Enterprise edition allows professionals to create robust distributed applications in a team setting. Introduction to Java Java is a high level, third-generation programming language, like C, Fortran, Pearl and many others. It is a platform for distributed computing a development and run-time environment that contains built-in support for the World Wide Web. History of Java Java development began at Sun Microsystems in 1991, the same year the World Wide Web was conceived. Javas creator, James Gosling did not design java for the Internet. His Objective was to create a common development environment for consumer electronic devices which was easily portable from one device to another. This effort evolved into a language , code named Oak and later renamed Java that retains much of the syntax and power of c++ , but is simpler and more platform independent. Java Features Some of the important features of Java are as follows: Simplicity Orientation Platform Independence Security High Performance Multi Threading Dynamic linking. Garbage Collection.

One of the most important feature of Java is Platform Independence which makes it famous and suitable language for World Wide Web.

Why java is Platform Independent ? Java is Platform Independent because of Java Virtual Machine (JVM). Java Virtual Machine (JVM) The client application or operating system must have a java byte-code interpreter to execute byte-code instructions. The interpreter is a part of a lager program called the JVM. The JVM interprets the byte code into native code and is available on platforms that supports java. When the user runs a Java program, it is upto the JVM to load , possibly verify, and then execute it. The JVM can perform this function from within a browser or any other container program or directly on top of the operating system. When a browser invokes the JVM to run a Java program, the JVM does a number of things : 1. It validates the requested byte-codes, verifying that they pass various formatting and security checks. 2. It allocates memory for the in coming java class files and guarantees that the security of JVM is not violated. This is known as the class loader. 3. it interprets the byte code instructions found in the class files to execute the program.

Connectivity using JDBC :There are four kind of drivers available in Jdbc :-

1. 2. 3. 4.

JdbcOdbc Bridge Driver. Partly Java Driver. Pure Java Driver. Native Driver.

JdbcOdbcDriver : This provides Jdbc access via Odbc drivers. Note that Odbc binary code , and in many case database client code, must be loaded an each client machine that uses this driver. As a result this kind of driver is most appropriate on a corporate network where client installations are not a major problem. Partly Java Driver : This Driver translates Jdbc calls into a Net Protocol which is then translated to a RDBMS protocolby a server.In this kind of driver part of the binary code should be on client machine and part should be on server, hence this kind of driver has same problem that was with JdbcOdbc driver and it is mostly used in Intranet. Pure Java Driver : This is a platform independent driver as this kind of driver remains on server. This kind of driver is provided by third party vendor. This net server middle ware is able to connect its pure java clients to many different databases. Native Driver : This kind of driver converts JDBC calls into the network protocol used by Dbms directly. This allows a direct call from client machine to the DBMS server and is a practical solution for Intranet access. Note :- We are using 3rd Type of driver i.e. Thin Driver in our project. (b) Oracle 8i (Back End ) ABOUT ORACLE 8.0

Oracle 8.0 contains all the features of previous version. It also supports some new features & enhancement to some existing features. Oracle servers provides deficient & effective solution for the major features. Large Database & Space Management Control Oracle supports the largest database potential hundreds of Giga Bytes in size. To make efficient use of expensive devices , it allows full control of space usage. Many Concurrent Database Performances It supports large no of concurrent users executing a variety of database Applications operation on the same data. It minimizes data connection & guarantees data concurrency. High Transaction Processing Performance Oracle maintains the processing features with a high degree of overall system performance. Database user doesnt suffer from slow processing performance. High Availability At some sets Oracle works 24 Hours per day with no downtime or limit database throughput. Normal system operation such as database backup & partial completion system failure dont interrupt database use. Controlled Availability Oracle can selectively control the availability of data at the database level & sub Database level. e.g. an administrator can disallow use of a specific application .Data can be reloaded without affecting other application. Industry Accepted Standards Oracle adheres to industry accepted standards for the data access language operating system, user interface & network communication protocols . It is open system that protocols a customer invention.

Manageable Security To protect against unauthorized database aspects & users .Oracle provides failsafe security features to limit & monitor the data area. The system make it easy to manage even the most completed designs for data assets. Database Enforced Integrity Oracle enforces data integrity Business rules that dictates the standards for applicable data. As result the cost of coding & managing checks in many database applications are eliminated. Distributed Database System For community environment that are connected via networks. Oracle combines the data physically located on the different computers in one logical database that can be accessed by all the network users. Distributed systems have same degree of user transparency & data consistency as nondistributed systems. Yet receives the advantages of local database management. Portability Oracle software is compatible to work under different operating system & same on all system. Application developed on Oracle can be used on virtually any system with little or no more modification. Compatibility Oracle software is compatible with industry standards, including most industry standards operating systems. Application developed on Oracle can be used on virtually any system with little or no modification. Connectivity Oracle software allows different types of computers & operating system to share information networks. NEW FEATURES OF ORACLE 8.0

Improved Scalability The maximum size of an Oracle database has been increased to support hundreds of terabytes depending on the operating system on which it resides. Improved Security Oracle 8.0 server now includes password management so that a password has a limited lifetime & must meet certain complexity such as minimum length. An account can be locked after a specified no of failed login attempts. Improved Performance Via Partition A table of index can divided into smaller pieces called patrons, based on the value of one or more columns. A table patron can be individually managed so that operation in one partition do not affect the availability of data on the other partitions. Also Insert ,Update ,Delete operation against a partitioned table can be processed partially. In other words, the Oracle 8 server can assign a portion of the work to execute a single DML statement to multiple processes , which may then be allocated to multiple processes by the server operating system. As a result ,the parallel DML operation is completed more quickly. Enhanced Support for Database Replication The performance & manageability of database replication have been significantly improved. Capability To Handle a Much Larger Number Of Concurrent Users By pooling database connection, the Oracle 8 server is able t9o service a much larger number of concurrent users up to 3000, depending on the server operating system & server hardware resources. New & Improved Data Types Some existing data types have been enhanced & new data types have been introduced.

Improved Select Statement A new feature of the select statement allows a sub query to be used in place of a table in a from clause. Tools/Environment used : Tools and Environment used in this project are as under: Software requirements Windows NT operating system. Front End : Swings, Event Handling, Servlets, JSP. Middle Ware : EJB. Back End : Oracle 8i. Connectivity : JDBC Thin Driver. Application Server : Weblogic Server 5.0.1

Hardware Requirements Cyrix 333 mzhs or Pentium II Processer. 128 MB SD RAM. Net Work with client server technology.

Feasibility Study : A feasibility study is conducted to select the best system that meets performance requirement. This entails an identification description, an evaluation of candidate system and the selection of best system for he job. The system required performance is defined by a statement of constraints, the identification of specific system objective and a description of outputs. The key consideration in feasibility analysis are :

1. Economic Feasibility : 2. Technical Feasibility : Hardware : (a) Server (b) Server space (c) Ram Windows NT 20 MB 128 MB Oracle 8I ASP net , Crystal Report. ASP net, Crystal Report. Windows NT

Software : (a) Backend (b) Middleware (c) Front-end (d) Operating System -

Economical:The proposed system is economically feasible because the cost involved in purchasing the hardware and the software are within approachable. The personal cost like salaries of employees hired are also nominal, because working in this system need not required a highly qualified professional. The operating-environment costs are marginal. The less time involved also helped in its economical feasibility.

Software Costing :Introduction Software Industry, an industry which sells logical things. The advantage of buying a software is automation, better analyzing of business, thus making life easier. As we are into logical selling, it makes difficult to come with a costing to an accurate level. Customer can see the benefits of buying only when he uses the software for quiet a period of time and then says 'Aah its worth of it'. When customer sees accountants performing better, invoices been made with least errors etc., customer gets convinced. So to convince the customer at the primary stage is really a big nut to crack. If you give more quote you lose the project, if you give less quote you will end up doing social service to clients and probably also loss. Software Industry, an industry which sells logical things. The advantage of buying a software is automation, better analyzing of business, thus making life easier. As we are into logical selling, it makes difficult to come with a costing to an accurate level. Customer can see the benefits of buying only when he uses the software for quiet a period of time and then says 'Aah its worth of it'. When customer sees accountants performing better, invoices been made with least errors etc., customer gets convinced. So to convince the customer at the primary stage is really a big nut to crack. If you give more quote you lose the project, if you give less quote you will end up doing social service to clients and probably also loss.

Theory
If said to analyze cost of any physical product, example a simple pen, I can pin point to a good extent the cap's cost, the ink cost etc., and come out with a rough estimation. Even the customer is equally convinced as he can see those physical products. Software industry also has practices of evaluating cost, the following are 2 major ones: 1. Lines of code. 2. Function points (FP). I personally do not believe in lines of code. In this software world of reusability, 1000 lines of code can become 200 lines, thus leading to

complete misjudgment. Just wondering during design phase how can you know the total lines of code. For some reason, I feel Lines of Code favor the software company more than its clients. Just imagine i want to make simple window based customer GUI in C language and the same in Visual basic. The Lines of code will differ a lot and hence the costing. In short lines of code are programming language dependent." Lines of code would have been fair if there was one programming language in the world". Just my 2 cents Programmers output is not Quantity (Lines of code) but the logic what he has written. If you want to evaluate a house cost do we ever measure the bricks and nails. Well i stop here talking about LOC or else the whole tutorial will look like i am against LOC. But with FP, I see the quote coming out fair for both customer as well as the software company and is language independent to a very good extent Note not completely independent). I was very convinced with FP in one of my clients' place where the client handed us a huge book of use case and said to come out with estimation. We where a team of 4 people. We divided in team of 2 and said let's come out with some quote and then tally our results. After 2 days continuously counting every element, we saw both teams coming to the same value of "Function Points", that means consistency even after different people sitting on it.

Definition of Function Point and History


They are units of software measurement, like for distance we have kilometer. There's a favorite saying - You can't control what you can't measure. Breaking the system into smaller systems, and analyzing them and coming out with cost for every unit. Finally, we total all the smaller units to come out with final total. Function points measure system from functionality perspective and are independent of technology.

Software Cost

J2EE : Ms-Office Oracle Manpower Cost : Team cost System Cost Total Cost Technical:-

25000/: :

15000/20000/-

: : :

15000/20,000/95000/-

Hardwares used in this project are- p3 processor 733 MHz, 64 MB RAM, 10 GB hard disk, floppy drive. These hardware were already available on the existing computer system. The software like MSACCESS,VB .net,MS -WORD and operating system WINDOWS-XP used were already installed On the existing computer system. So no additional hardware and software were required to purchase and it is technically feasible. Tools Used : 1) J2EE API 2.1 2) Weblogic Server 6.0 3) Data Report 4) JDK 1.3 5) Oracle 8i.

Duration of Project :For studyFor designingFor development15days, 45days, 60 days,

For TestingTotal time-

15days, 135 days.

Methodology: The following approach is used to design this system, which is called classic life cycle or waterfall model. This linear sequential model suggests a systematic, sequential approach to software development that begins at the system level and progress through analysis, design, coding, testing and maintenance. The linear sequential model encompasses the following activities:1. 2. 3. 4. 5. 6. System / information engineering and modeling. Software requirement analysis. Design. Code generation. Testing. Maintenance.

System Engineerin Analysis Design Code Testing Maintenance

Analysis :MY ROLE :My role in this project was to do Analyzing, designing and coding. I was involved in development of :1. module of this project. The project is Divided into different modules as above discussed: Module Description and Design :Program Structure : Title of this project is On line Shopping Web Site , Objective of this project is to do on line sale and purchase of the registered products. Basically this site is acting as a middlemen connecting two different people i.e. Seller and Buyer. Seller is the person who wants to sell off his

product where as Buyer is a person who is making bid on a product. Both Seller and Buyer has to register them selves by paying an annual subscription amount. Seller has to register his product also by paying the 2% security of market price. Buyer will be using search engine to search for the registered products and then after that can make purchase on the selected product of his choice We have used Java Language and Oracle as a backend Data Base. My role in this project was to do Analyzing , designing and coding. I was involved in every sphere of this project. The project is Divided into different modules some of the forms are as under : Login Verification. Change Password Forget Password Company Registration User Registration Company Bank Form. User Bank Company Introduction Form User Introduction Form Network Chat Mail Server.

Some of the modules is divided into different Sub Modules. Now I am explaining each module in detail.

Login verification :- In this module we are checking the authenticity of the person who is using this application . Person who is using this application should enter correct userid and password to authenticate him self. Hence first form that opens up is a verification form, we are taking input from the user of this software i.e. user id and password then we are checking this input from our database if it is correct then we are opening First form i.e. Introduction form. Change Password :- By this module user can change his password from old password to new password. He has to enter some information like User Id , old Password, new Password and reconfirm password. Then we have to first verify that new password and reconfirm password matches, If it does not matches then we have to send user back to change password form else if it matches then we have to check weather he is a member or not. This is done through verifying User Id and Old password if they matches with our data base then it means he is a member other wise not. If he is not a member then again we are redirecting him back to Change password form with a error message else if he is a member we will change his Old Password to New Password and confirm him the New Password. Forget Password: By this module user can get his password if he has forgotten his password. For this particular purpose user first has to enter his User Id and we have to verify his ID i.e. weather he is a member or not. If he is not a member then we have to redirect him back to Forget password form else we have to open another form indicating his Secret Question. He has to enter correct Secret Answer to confirm his Password. If he enters wrong Secret Answer then we have to again redirect him back to Forget Password form else we have display his Password. Company Registration Form: This is the first form when client i.e. Company visit this site for the first time. As already discussed earlier

both Company and User has to register them selves. This is a Company registration form where user has to fill up information like his Company name , address , Email , Tel , Fax , secret question , secret answer etc along with Company user id and password. We have to test his user id before registering him, as user id, which he is choosing, should not exist in database. User id is a primary key and should be unique. We have to make connection with the database and check weather userid already exist or not. If it exist in data base then we have to open the same registration again with all the filled up fields like his Company name, address, email, secret question, secret answer etc. else if userid does not exit in data base we have to open Company bank form. Note * - we are not inserting the record into the database we are just redirecting him to Company bank form. User Registration Form: This is the first form when client i.e. User visit this site for the first time. As already discussed earlier both Company and User has to register them selves. This is a Company registration form where user has to fill up information like his Company name, address, Email, Tel, Fax, secret question, secret answer etc along with Company user id and password. We have to test his user id before registering him as user id which he is choosing should not exist in data base. User id is a primary key and should be unique. we have to make connection with the database and check weather userid already exist or not. If it exist in data base then we have to open the same registration again with all the filled up fields like his Company name , address, email , secret question , secret answer etc. else if userid does not exit in data base we have to open User Inroduction form. After successfully logging on our server side program will be checking the status of the person i.e. weather he is logging on as a a) b) Company User Case A :- Let us first assume that he is logging in as a Company.

Company Introduction Form: After successfully logging in the first forms that the company get is Company Registration Form. This form has three hyper links i.e. Register your Product. Update your Product. My Status.

Register your Product : We have categorized products into different broad categories which are as under :1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Automobiles Garments Property Antique Celebrity Item Computers Consumer Products. Books Jewelry furniture Live stock. Industrial Scrap.

After logging in the Seller has the options of registering his product , updating his products and he can also check his status. Let us assume he wants to register his product for that particular thing we will open select category form. Select Category Form: In this particular form seller has to select from the broad categories as listed above the particular category in which his product falls and he will select that category. Category Form: After Select Category Form, a particular category form will open. We have made different html forms for different categories like an Automobile form for an Automobile Category or a Garment Form for a Garment category. A particular form of the

particular category will open on selection of the category. Company has to fill up these information in the Category form i.e. Quantity of goods available. Price per item Quality of goods User Id Description of his product.

We are taking user id to ascertain that to whom this product belong to. Description of the product means that he has to describe his product like if it is a automobile he has to give item name like Bus, Sccoter , Moter cycle etc then he has to give color , average, fuel type, condition etc. After Registering his product he has to pay 2% security of value of registered price. Bank Form : After Company is registered he has to pay registration amount through bank. He has to fill up information like Bank ID, Bank Address, Account Holders Name, Cheque or DD number. It is through this form that we will be entering records in two tables simultaneously by making two connection objects , first table is the Company Registration table and another table is the Bank table. Similarly is the procedure for product registration, as our server side program will calculate the 2% security of the value of registered price and insert the records in the database here we will generate the Item ID and display to the seller that his Product has been registered and the Product Id will be generated which he can use for future reference purpose. Update your Product: Next link is Update your product by going on to this link seller will get Product Updation Form in which he will select the category of the product with Product ID , he will get the Filled up product registration form here he can make changes to his product like change product price or can change description etc.

But server side program is conducting one validation check i.e. weather shopping has already started on this product or not. If the shopping has already started then he cannot make changes to his product but if the shopping has not started then he can make changes to his product. My Status : Last link in this module is My status. This module will show the status of the Company i.e. How many products the Company has registered. Product Id of different products registered by the Company. Quantity of goods available User ID. Of person who has purchased the product. Current Status what is the quantity of goods purchased , who has placed the order , what is the address , Email , paymode etc. Case B :- Let us first assume that he is logging in as a User. User Introduction Form: After successfully logging in the first forms that the User get is User Introduction Form. This form has three hyper links i.e. Do Shopping Update Shopping. My Status.

Do Shopping : By going on to this link User will get the Search Engine specific to site which will be searching the registered products from the data base. Search Engine : In this search engine User will be selecting the category of the product on which he wants to make a bid and he will also be specifically entering the item name in the search criteria. Take an example he wants to do shopping of a Car. In that particular case

he will be selecting the automobile from the broad category and then writing car in the search criteria. By selecting the broad category we will come to know the name of the table in which he wants to make a search and what he wants to search weill get from item name. The search engine will display following information : Name of the Product. Product Id of the Product. Description of the product. Days left in shopping. Item price. Discount if any.

User can then select the particular product of his choice and a Shop Form will open. Shop Form: In this module User will be searching for the products and will select the product along with the quantity purchased and will add items to the cart. We will be using the session tracking here. After doing add to cart User will get the total price due. He can update his shopping as well as can also make final order, which will be placed, and shopping id will be generated. Update your Shopping : By this module person can update his previous shopping. It is not necessary that every time User want to make new shopping he has to go to search engine and search for the product he can just go to Update Shopping form and can update his bid. In update form he has to enter his Shopping id and has to select the category of product, After selecting program will verify that weather he has entered right shopping id or not if the id is wrong then we will display error message else if id is right we will open Shop Now Form where he will get the last order entered by him with the total price. If he is interested he can update his Shop cart i.e. can make more purchases or can reduce the purchases.

My Status :My Status will display the status of the User. Last link in this module is My status. This module will show the status of the User i.e. How many products has been purchased by the User. Product Id of different products registered by the User.. Date of purchase. Total Price Due Current Status what is the status of product i.e. weather dispatchment has been done or not.. Further details of the project is provided in Attachment. 1. 2. 3. Data Flow Diagram. Synopsis Data Structure.

Network Chat : This is a software which can be incorporated with this project. Objective of making up this software is to enhance my knowledge in the field of Java as in my project I was using only Java Servlets with Jdbc, I was not using the every technology in java. The scope of making this software is that in this particular software I am using technologies like : Applet. Servlet. AWT. Multi Threading. Event Handling. Exception Handling. Input/Output. Net Working.

By using all these topics I am increasing the scope of my area .The advantages in which this software can be used in my Project is that we can incorporate this software in this site by which different people

around the world can communicate with each other using this software. Basically in this software we are Applet Servlet Communication.

Mail Account with in Organization.: This is also a software by which we are making mail account of Employees of organization, which they can access. We have used Java Mail Package with SMPT to make up this software.

Software Requirement Specification (According to IEEE Standard no. 830-1984) 1. Introduction : This website is dedicated to online Auction site. The objective of this site is to provide an opportunity to the potential users(Seller and Buyer ) who are remotely located over a large geographical area. This site also provides automated information in globalised form. 2. Information Description : The website act as a middleman between between Seller and Buyer. In this site the Company registers his jobs and the user searches for job and apply for a job. The website performs necessary condition checking and selects a highest quality human power for a particular product. The website confirms the job and pass the information to the above said users.

3. Functional Description : Basically the website has four modules. Some of the forms are described below :

(A) (B)

Login Module : The user enters in this module through home page if user already registered himself on the site. He module checks his/her record and then confirms his authenticity. Change Password Module : This module is also for existing user. If user wishes to change his password the module interacts with him/her and confirms his authenticity. After confirmation, it writes in the registration table. Forget Password Module : This module is also for existing user. If the user forgets his/her password, the module interacts with database and flashes secret question, which is entered by the user during registration process and asks for secret answer. The module matches the response with the database and if it is ok the show the password. New User Signup Module : This module is for new user. The user enters in this module by clicking on the hyperlink on the home page and fills the registration form. After filling the registration form he have to fill a bank form to get him registered.

(C)

(D)

4. Behavioral Description : The event occurs in this site in two ways. One by the submission of the form by the user and other by the web page. When the user submits a particular form a particular servlet is called depending upon the nature of the job is to be perform. The servlet either generates the response or updates the database or both. Following events occur in the modules : Module: Change Password

1. 2. 3.

Submission of form Accessing of database Generation of appropriate response.

Module: Forget Password 1. 2. 3. Submission of form Accessing of database Generation of appropriate response

Module: New User Signup 1. 2. 3. Submission of form Updating database Generating appropriate response

Module: Login 1. 2. 3. 4. 5. Submission of form Accessing of database Generation of appropriate form Submission of form Updating database

5. Validation Criteria : Each HTML page and its hyperlink is examined and the respective servlet is also examined. The connection between form (Front-end ) and database (Backend) is examined keeping in the mind hat no garbage value could be entered. Middleware or processing logic is also examined.

Validations Checks : Developing project has number of phases, we have to under go each phase in order to successfully complete the whole project. Different steps which we have to follow in order for successfully completion of project are :-

Analyzing. Making up of Project Synopsis and Documentation In this phase we do paper work ,write the client requirement and design database according to the requirement of client. After that we divide the whole project into different modules and assign task to the Project members. Coding In this phase we actually practically implement paper work and do the front end and back end programming part. Testing This is the most important phase of the Project where we practically check our code in different situations i.e. weather it is working in different conditions or not , weather it is solving the objectives of client. During this phase only we do rectification job. The most important technique used in Testing is Trial and Error System. We will be discussing this in detail later.

Incorporating Incorporating means loading the application on to the server from where it will be used by the client machines. Training After Incorporating the code on to the client machine we have to provide training to the employees of the client i.e. how to use this software and if there is any problem they can do verification part.

Here we will be discussing Testing Part i.e. Validation Checks. As already told one of the most important technique of Testing is Trial and Error System In this system we put our code to different conditions to check that weather it is working properly or not. We also have adopted this technique.

We have done data verification by entering wrong data type in our data base to test weather it is working properly. We tried to search records from different tables using Primary Key i.e. particular ID and checked weather it is fetching correct record or not. We have tested weather proper records according to proper fields are inserted to the tables or not. We have also used scripting to verify our code. Scripting are of two types i.e. Client Side Scripting and Server Side Scripting. Client Side Scripting : We have used Java Script for client side scripting. By client side scripting we do validation part on client side i.e. at front end , before submitting up of form. Examples of Client side scripting it that there are some compulsory fields which has to be filled but are not filled up by the client in that particular case form should not be submitted and an error message should be displayed , similarly like that take an example there are two fields one numeric like age and other text like name user has to enter numeric in numeric field and text in text field but if does not do so an error message should be displayed stating that he has made wrong entry. This kind of technique where Information is tested on client side befor going on to server side program is called Client Side Scripting. Server Side Scripting : Server side Scripting is done by server side program . There are certain things which has to be tested on server side like Employee ID , Department ID or User Id. For this particular case we have to first make connection with our data base and then test weather User Id actually exist in our database or not if userid exist it means he is a member other wise not. Similarly if we want to check record of employee this will we done by Employee ID i.e. primary key in a database these type of checks will be performed by Our Server Side Program. In last I am stating that I have performed all the validation checks upto my knowledge and is satisfied that my code is running properly.

SYSTEM TESTING

Here the system testing involved is the most widely used testing process consists of five stages as shown in the figure. In general, the sequence of testing activities is component testing, integration testing then user testing. However, as defects are discovered at any one stage, they required program modifications to correct them and this may required other stages in the testing process to be repeated.

Unit testing

Module testing Sub-system testing System testing

Acceptance testing

(component testing) SYSTEM SECURITY

(Integration testing)

(user testing)

There are basically two types of security associated with this system:1. Physical security:Damage due to natural causes like earth tremor, flooding, water logging, fire hazards, atmospheric or environmental conditions etc..For overcoming these difficulties the replica of the data are automatically stored at various networks and for environmental conditions Air conditioning environment is created. 2. Data security:There are basically two problems associated with data security:a). Data not being available to the authorized person at the time of need.

b). Data becoming available to the unauthorized person. To overcome these difficulties the following access facilities has been provided:i) ii) Identification:Unique Ids for the different users have been provided. Authentication:System checks the password under the particular user identification. The computer permits the various resource to the authorized person.

iii)

Authorisation:The access control mechanism to prevent unauthorized logging to the system.

Our Testing Policy For Us, Primary role of testing is not demonstration of correct performance, but exposure of hidden defects, detecting specification errors and deviations from the specification, establishing confidence that a program does what it is supposed to do and verifying that a system satisfies its specified requirements or identifying the differences between expected and actual results Our Testing Process
1. Test Planning

Describing the scope, approach, resources and schedule of intended test activities, also describes the technical and managerial approach to be followed for testing a component or system

2. Test Specification

Specifies the test inputs, execution condition and predicted results for an item, unit, integration and system level test cases are designed on the basis of requirements and as per the plan lay down
3. Test Execution

Test cases are executed according to the test procedures prepared for each test designed, test procedure describes the purpose, special requirements and the steps to be followed in executing the tests
4. Test Recording.

All executed tests have test log. Whenever discrepancies are observed from the expected results, test incidents must be raised. Test Log is a record of all relevant details of execution of tests. Test incident records any event that occurs during testing that requires investigation
5. Test Completion

Test records are checked against test completion criteria. Every test must be completed and there must be no defect logged during execution phase that is not fixed by respective developer and if fixed should not remain untested by testing resource Adapted Software Test Life Cycle

Test Planning

Test Design

Test Case Design

Test Summary

Test Completion

Test Execution

Our Testing Techniques and Levels of Testing

Unit Testing Testing logical pieces of work, functions, subroutines or logical units, generally conducted by developer. Our approach towards Unit testing is a. Document all test cases, and test procedures, review all test cases b. Execute implemented test set on compiled unit c. Modify and revise the code and test as necessary d. Re-execute the modified tests until test completion criteria re met Integration Testing. Our main function of integration testing is to test that interfaces between units are correct, after few units are integrated verify that specific requirements have been implemented correctly. Test response time of integrated modules is another aspect that we take care. Our approach towards Integration Testing is a. Identifying the integration test sets and their execution b. Units are combined one at a time and tested till entire software gets integrated c. Verifying that data flow between the screens is correctly integrated d. Verifying that all the integrated modules and units are behaving as per specifications Regression Testing. Testing of all the effected screen or module due to defect fix or change in the requirement is our aim at regression testing. Tasks that we perform during a regression test are a. Testing a defect fix b. Testing that a defect fix has not caused some other error c. Both are done by regression testing by running a set of test cases run previously System Testing System testing for us is not a process of testing the functions of the complete system which has already been achieved by function testing,

but it is a process of attempting to demonstrate how the program does not meet its objectives a. Test cases derived using black box methodology b. While functional testing can be taken up in any hardware, the system testing has to be taken up only with target hardware. c. In addition to functionality, other aspects such as usability, performance, recovery etc tested.

Acceptance Testing. For us Acceptance testing is conducted to determine whether a software system satisfies its acceptance criteria, this is the reason we conduct acceptance testing on actual environment and data. The final acceptance decision holds with every individual client, we verify that the delivered product is adequate and consistent with executable system and the complete system meets the buyers requirements. Our acceptance process is a. Define buyers role b. Define acceptance criteria c. Develop acceptance plan d. Execute acceptance plan e. Develop acceptance decision

CONCLUSIONS FINDINGS:After implementing the system in the market its advantages were incomparable to the present contemporary systems available in the market. The most admirable feature founded was its simplicity in terms of application to the user but its highly beneficial outputs cant be ignored. The users will be highly benefited after using the system. LIMITATIONS:Since, every system has some limitations so our proposed system is also not untouchable in this regard. Although it includes every kind of features but it cant be used in a huge organization where number of networks are very large, because the data base used in this system is an average one. Also it doesnt have different kind of access feature for different users. SCOPE FOR FUTURE WORK :Since this system has been generated by using Object Oriented programming, there are every chances of reusability of the codes in other environment even in different platforms. Also its present features can be enhanced by some simple modification in the codes so as to reuse it in the changing scenario. Scope of future application: We can implement easily this application. Reusability is possible as and when we require in this application. We can update it next version. We can add new features as and when we require. There is flexibility in all the modules.

SOFTWARE SCOPE Reusability: Reusability is possible as and when we require in this application. We can update it next version. Reusable software reduces design, coding and testing cost by amortizing effort over several designs. Reducing the amount of code also simplifies understanding, which increases the likelihood that the code is correct. We follow up both types of reusability: Sharing of newly written code within a project and reuse of previously written code on new projects. Extensibility: This software is extended in ways that its original developers may not expect. The following principles enhance extensibility like Hide data structure, Avoid traversing multiple links or methods, Avoid case statements on object type and distinguish public and private operations. Robustness: Its method is robust if it does not fail even if it receives improper parameters. There are some facilities like Protect against errors, Optimize after the program runs, validating arguments and Avoid predefined limits. Understandability: A method is understandable if someone other than the creator of the method can understand the code (as well as the creator after a time lapse). We use the method, which small and coherent helps to accomplish this. Cost-effectiveness: Its cost is under the budget and make within given time period. It is desirable to aim for a system with a minimum cost subject to the condition that it must satisfy all the requirements. Scope of this document is to put down the requirements, clearly identifying the information needed by the user, the source of the information and outputs expected from the system.

PERT (Performance Evaluation and Review Technique) Like Gantt chart PERT also makes use of tasks. It shows achievement. These achievements are however not task achievement. They are terminal achievement called events. Arrow are used to represent tasks and the circle represent the beginning or completion of the task. The PERT chart uses these paths and events to show the interrelationship of project activation. Activity 1. Task

Design Forms Design home page Design Change Password Page Design Forget Password Page Design New User Signup page 2. Design Front End Design Login Design Forget Password Design Change Password Design New User Signup Link middle ware With Form Test program and Form Prepare Documentation

3. 4. 5.

PERT CHART
Design change password page Design forget password page Design New User Signup Page 10 8

4 Design home page 4 Link prog and form 2 2 0 2 1 Begin Work Design login 8 3 Design forget password 5 5 10

25

20 9

Prepare Documenta tion 30

Test prog and form

11

7 Design change password

Gannt Chart
Basic planning uses bar chart that shows project activation and amount of time they will take. The Gantt chart uses horizontal bars to show the duration of actions and tasks. The left end marks the beginning of the task , the right end its finish. The heavy horizontal bars are activities and the light horizontal bars are tasks. Broken horizontal bars are estimated time delays or slack time.

Activity
1. Design forms Design home page Design change password page Design forget password page Design new user signup page Design Front End Design login Design change password Design forget password Design new user signup link program with form Test program and form Prepare documentation

Task

2.

3. 4. 5.

Time in days 0 Activity 1. 1.1 1.2 1.3 1.4 v 2. 2.1 2.2 2.3 2.4 3 4 5 v v v 5 10 v 15 20 25 30 35 40 45

Form Design

Servlet Design

Link Testing Establishment Documentation

Figure :- Gantt Chart

REFERENCES:-

BOOKS1. OFFICE 2000 By COURTER MARQUIS. 2. JAVA SERVLETS 6.0 By GARRY CORNELL. 3. SYSTEM ANALYSIS AND DESIGN By ELIAS M AWAD. 4. SOFTWARE ENGINEERING By IAN SOMMEVILLE. 5. R.M INFOTECH MATERIALS. WEBSITES:1. GOGGLE.COM. 2. WEBOPEDIA.COM. 3. DDJ.COM

ONLINE SHOPPING

Description:

This is the homepage of Online Shopping Management. If a company is already registered in the site then company can login himself for further processing. Else he have to newly register himself first. A registered company can change his Password.
User can login himself for placing orders of the products. Also a new user can register himself and can change Password. Coding: Client 1: <html><head> <title > ON LINE SHOPPING

</title> </head> <body LINK=brown VLINK=brown ALINK=SILVER BGCOLOR=lightpink> <CENTER><TABLE WIDTH=40% BGCOLOR=""> <TR ALIGN="CENTER"><B><font color=brown size=6>SHOPPING WORLD</font></b> </TR> </TABLE></CENTER> <table> <tr><pre> </pre><pre> </pre></tr> <tr><td VALIGN=TOP > <form Method="Post" Action="http://localhost:7001/cologinClient" Name="f1"> <table> <tr> <td><font color="brown" size="5"><B><i> Comp Name : </i></b></font> </td> <td> <input type=text name=T1> </td> </tr> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <tr> <td><font color="brown" size="5"><B><i> Comp Password:</i></b> </font> </td> <td> <input type=text name=T2> </td> </tr> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <tr> <td> </td> <td><input type=submit value=login color=red onClick="checkform();"> </td> </tr> <tr> <td> </td> <td>

<A Href="http://localhost:7001/compregnClient"> New Company</A> </td> </tr> <tr> <td> </td> <td> <A Href="http://localhost:7001/compchangeClient"> Change password</A> </td> </tr> <tr> <td> </td> <td> <A Href="http://localhost:7001/compforget1Client"> Forget password</A> </td> </tr> <SCRIPT LANGUAGE="JavaScript"> <!-function checkform() { if (document.f1.T1.value=="") { alert("please enter company i.d"); document.f1.T1.focus(); } else if (document.f1.T2.value=="") { alert("please enter company PWD"); document.f1.T2.focus(); } else { document.f1.submit(); } } //--> </SCRIPT>

</table></form></td> <td><pre> </pre> </td> <td VALIGN=TOP> <form Method="Post" Action="http://localhost:7001/ulogClient" Name="f2"> <table> <TR> </TR> <tr> <td><font color="brown" size="5"><B><i>User Name:</b></i></font> </td> <td><input type=text name=T1> </td> </tr> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <tr> <td><font color="brown" size="5"><B><i>User Password: </i></b></font> </td> <td><input type=text name=T2> </td> </tr> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <TR> </TR> <tr> <td> </td> <td><input type=submit value=login onclick=checkForm();> </td> </tr> <tr> <td></td> <td> <A Href="http://localhost:7001/regnClient"> New User</A> </td> </tr> <tr> <td></td> <td>

<A Href="http://localhost:7001/changeClient"> Change Password</A> </td> </tr> <tr> <td></td> <td> <A Href="http://localhost:7001/forget1client"> Forget Password</A> </td> </tr> <SCRIPT LANGUAGE="JavaScript"> <!-function checkForm() { if (document.f2.T1.value=="") { alert("please enter User i.d"); document.f2.T1.focus(); } else if (document.f2.T2.value=="") { alert("please enter password"); document.f2.T2.focus(); } else { document.f2.submit(); } } //--> </SCRIPT> </table></form></td></tr></table> </body> </html>

Client 2:

This servlet is used to check whether the company ID exist or not. If exist then welcome page will be displayed else remain in the same page.

import javax.naming.*; import java.rmi.*; import java.util.*; import java.io.*; import javax.rmi.PortableRemoteObject; import javax.servlet.*; import javax.ejb.*; import javax.servlet.http.*; public class cologinClient extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { String uid=req.getParameter("T1"); String pwd=req.getParameter("T2"); HttpSession ses=req.getSession(true); ses.putValue("cologinClient", uid); System.out.println("Company ID inside cologinclient is : "+uid); System.out.println("inside try..."); Context ic=getInitialContext(); Object ref=ic.lookup("cologinClient"); System.out.println("lookup done..."); cologinHome hm=(cologinHome)PortableRemoteObject.narrow(ref,cologinHome.class); cologinRemote rmt=hm.create(); System.out.println("create called.."); Vector v1=new Vector(); v1.addElement(uid); v1.addElement(pwd); System.out.println("vector added..."); rmt.loginComp(v1,req,res); System.out.println("create called.."); rmt.remove(); } catch(java.rmi.RemoteException e) { System.out.println("Remote exception:"+e); } catch(javax.ejb.CreateException e) { System.out.println("Create exception:"+e); } catch(javax.ejb.RemoveException e) {

System.out.println("Remove exception:"+e); } catch(javax.naming.NamingException e) { System.out.println("Naming exception:"+e); } } private static Context getInitialContext() throws NamingException { Context ctx =null; try { Properties h = new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL, "t3://localhost:7001"); ctx = new InitialContext(h); } catch (Exception ne) { System.out.println("Exception in getting ic "+ne); } System.out.println("context returned.."); return ctx; } } Home Interface: import javax.ejb.*; public interface cologinHome extends EJBHome { public cologinRemote create() throws java.rmi.RemoteException,javax.ejb.CreateException; } Remote Interface: import javax.ejb.*;

import javax.servlet.*; import javax.servlet.http.*; import java.rmi.RemoteException; import java.util.*; //for vector import java.io.*; public interface cologinRemote extends EJBObject { public void loginComp(Vector v,HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException,java.rmi.RemoteException; } Bean: import javax.ejb.*; import java.sql.*; import javax.sql.*; import java.util.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.naming.*; public class cologinBean implements SessionBean { SessionContext ctx=null; Connection con=null; Statement stat=null; ResultSet rs=null; public void ejbCreate() //used defined method { } public void loginComp(Vector v, HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException //(3) { try { String a=""+v.elementAt(0); String b=""+v.elementAt(1); InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); con=ds.getConnection(); stat=con.createStatement(); rs=stat.executeQuery("select * from cologin where cid='"+a+"'"); if(rs.next())

{ System.out.println("inside if....."); res.sendRedirect("http://localhost:7001/cohello"); } else { System.out.println("inside else.........."); res.sendRedirect("http://localhost:7001/home.html"); } } catch(Exception e) { e.printStackTrace();} } public void ejbRemove() { } public void ejbPassivate() //(4) { } public void ejbActivate() //(2) { } public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

//(1)

Description:

This is the welcome page for the project. One can register product, Update product and can view Product Status.
Coding: Client: import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class cohello extends HttpServlet{ public void doGet (HttpServletRequest request , HttpServletResponse response) throws ServletException , IOException{ String T1= null; HttpSession session= request.getSession(true);

if(session !=null){ T1= (String)session.getValue("T1"); } response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<head><title>shopping</title></head>"); out.println("<body><center>"); out.println("<h1>Welcome </h1>"); out.println("<table border=0 cellspacing=30 cellpading=0 >"); out.println("<tr><th><a href='http://localhost:7001/ptype.html'>Registerd your product</a></th></tr>"); out.println("<tr><th><a href=upproduct.html>Update your product</a></th></tr>"); out.println("<tr><th><a href=statusproduct.html> Product Status</a></th></tr>"); out.println("</table>"); out.println("<center></body>"); out.println("</html>"); out.close(); } }

Description: This page is used to register a new Company. He needs to enter his complete details with secret question and secret answer. When company will fill up the form with appropriate values inside the fields he will be registered and the home page will be displayed. Client: import javax.naming.*; import java.rmi.*; import java.util.*; import java.io.*; import javax.rmi.PortableRemoteObject; import javax.servlet.*; import javax.ejb.*; import javax.servlet.http.*; public class compregnClient extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { try

{ res.setContentType("text/html"); PrintWriter out=res.getWriter(); Vector v=new Vector(); HttpSession ses=req.getSession(true); v=(Vector)ses.getValue("son"); if(v==null) { out.println("<html><head><title>GET REGISTERED</title></head>"); out.println("<body bgcolor=lightpink>"); out.println("Welcome! GET Registered here:"); out.println("<center><form method=Post action='http://localhost:7001/compregnClient'>"); out.println("Enter companyid:<input type=text name=t1><br><br>"); out.println("Enter name:<input type=password name=t2><br><br>"); out.println("Enter password:<input type=text name=t3 ><br><br>"); out.println("Enter retype your password:<input type=text name=t4 ><br><br>"); out.println("Enter sec question:<input type=text name=t5 ><br><br>"); out.println("Enter sec answer:<input type=text name=t6 ><br><br>"); out.println("Enter address:<input type=text name=t7 ><br><br>"); out.println("Enter city:<input type=text name=t8 ><br><br>"); out.println("Enter country:<input type=text name=t9 ><br><br>"); out.println("Enter product:<input type=text name=t10 ><br><br>"); out.println("<input type=submit>"); out.println("<input type=reset>"); out.println("</form></center></body></html>"); } else { // String b=""+v.elementAt(1); String c=""+v.elementAt(1); String d=""+v.elementAt(3); String e=""+v.elementAt(4); String f=""+v.elementAt(5); String g=""+v.elementAt(6); String h=""+v.elementAt(7); String i=""+v.elementAt(8); String j=""+v.elementAt(9); out.println("<html><head><title>Registration Form</title></head>"); out.println("<body bgcolor=blue>");

out.println("<center><form method=post action='http://localhost:7001/compregnClient'>"); out.println("Enter companyid & password"); out.println("Enter companyid:<input type=text name=t1><br><br>"); out.println("Enter name:<input type=password name=t2 value='"+c+"' ><br><br>"); out.println("Enter pwd:<input type=text name=t3 ><br><br>"); out.println("retype pwd :<input type=text name=t4 value="+d+"><br><br>"); out.println("Enter secq:<input type=text name=t5 value='"+e+"'><br><br>"); out.println("Enter seca:<input type=text name=t6 value='"+f+"'><br><br>"); out.println("Enter address:<input type=text name=t7 value='"+g+"'><br><br>"); out.println("Enter city:<input type=password name=t8 values="+h+" ><br><br>"); out.println("Enter country:<input type=text name=t9 value='"+i+"'><br><br>"); out.println("Enter product:<input type=text name=t10 value='"+j+"'><br><br>"); out.println("<input type=submit>"); out.println("<input type=reset>"); out.println("</form></center></body></html>"); } } catch(Exception e) { e.printStackTrace();} } public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { Context ic=getInitialContext(); Object ref=ic.lookup("compregnClient"); compregnHome hm=(compregnHome)PortableRemoteObject.narrow(ref,compregnHome.class); compregnRemote rmt=hm.create(); PrintWriter out=res.getWriter(); String cid=req.getParameter("t1"); String name=req.getParameter("t2"); String cpwd=req.getParameter("t3"); String rpwd=req.getParameter("t4"); String secq=req.getParameter("t5"); String seca=req.getParameter("t6"); String address=req.getParameter("t7"); String city=req.getParameter("t8"); String country=req.getParameter("t9");

String product=req.getParameter("t10"); Vector v1=new Vector(); v1.addElement(cid); v1.addElement(name); v1.addElement(cpwd); v1.addElement(rpwd); v1.addElement(secq); v1.addElement(seca); v1.addElement(address); v1.addElement(city); v1.addElement(country); v1.addElement(product); rmt.getRegn(v1,req,res); out.println("<html><head></head>"); out.println("<body>"); out.println("Hello! New Member"); out.println("</body></html>"); rmt.remove();

} catch(java.rmi.RemoteException e) { System.out.println("Remote exception:"+e); } catch(javax.ejb.CreateException e) { System.out.println("Create exception:"+e); } catch(javax.ejb.RemoveException e) { System.out.println("Remove exception:"+e); } catch(javax.naming.NamingException e) { System.out.println("Naming exception:"+e); } } private static Context getInitialContext()throws NamingException { System.out.println("we r in private........");

Context ctx=null; try { //System.out.println("we r in try block.........."); Properties h= new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL,"t3://localhost:7001"); ctx=new InitialContext(h); } catch(Exception ne) { System.out.println("exception in ic:"+ne); } return ctx; } }

Home Interface: import javax.ejb.*; import java.rmi.*; public interface compregnHome extends EJBHome { public compregnRemote create() throws java.rmi.RemoteException, javax.ejb.CreateException; } Remote Interface: import javax.ejb.*; import javax.servlet.*; import javax.servlet.http.*; //import java.rmi.*; import java.rmi.RemoteException; import java.util.*; //for vector import java.io.*; public interface compregnRemote extends EJBObject

{ public void getRegn(Vector v,HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException,java.rmi.RemoteException; } Bean: import javax.ejb.*; import java.sql.*; import javax.sql.*; import java.util.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.naming.*; public class compregnBean implements SessionBean { SessionContext ctx=null; Connection con=null; Statement stat=null; ResultSet rs=null; public void ejbCreate() //used defined method { } public void getRegn(Vector v, HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException //(3) { try { HttpSession ses=req.getSession(true); //ses.putValue("son",v); String a=""+v.elementAt(0); String b=""+v.elementAt(1); String c=""+v.elementAt(2); String d=""+v.elementAt(3); String e=""+v.elementAt(4); String f=""+v.elementAt(5);

String g=""+v.elementAt(6); String h=""+v.elementAt(7); String i=""+v.elementAt(8); String j=""+v.elementAt(9); InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); con=ds.getConnection(); stat=con.createStatement(); rs=stat.executeQuery("select * from comp_regs where cid='"+a+"'"); if(rs.next()) { ses.putValue("son",v); res.sendRedirect("http://localhost:7001/compregnClient"); } else { System.out.println("parag in insert............"); String qry="insert into comp_regs values( '"+a+"', '"+b+"', '"+c+"','"+d+"','"+e+"','"+f+"','"+g+"','"+h+"','"+i+"','"+j+"')"; System.out.println("qry :"+qry); stat.executeUpdate(qry); res.sendRedirect("http://localhost:7001/home.html"); } } catch(Exception e) { e.printStackTrace();} } public void ejbRemove() { } public void ejbPassivate() //(4) { } public void ejbActivate() //(2) { } public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

//(1)

Description:

This page is used to change the password of the registered Company. If the password is changed successfully home page will be displayed.
Coding:

Client: import javax.naming.*; import java.rmi.*; import java.util.*; import java.io.*; import javax.rmi.PortableRemoteObject; import javax.servlet.*; import javax.ejb.*; import javax.servlet.http.*; public class compchangeClient extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { try { res.setContentType("text/html"); PrintWriter out=res.getWriter(); Vector v=new Vector(); HttpSession ses=req.getSession(true); v=(Vector)ses.getValue("son"); if(v==null) { out.println("<html><head><title>Change Password</title></head>"); out.println("<body bgcolor=lightpink>"); out.println("Welcome! Change Your Password:"); out.println("<center><form method=Post action='http://localhost:7001/compchangeClient'>"); out.println("Enter companyid:<input type=text name=t1><br><br>"); out.println("Enter old password:<input type=password name=t2><br><br>"); out.println("Enter new password:<input type=text name=t3 ><br><br>"); out.println("Enter confirm password:<input type=text name=t4 ><br><br>"); out.println("<input type=submit>"); out.println("<input type=reset>"); out.println("</form></center></body></html>"); } else {

String c=""+v.elementAt(2); String d=""+v.elementAt(3); out.println("<html><head><title>Registration Form</title></head>"); out.println("<body bgcolor=blue>"); out.println("<center><form method=post action='http://localhost:7001/compchangeClient'>"); out.println("Change your password"); out.println("Enter companyid:<input type=text name=t1><br><br>"); out.println("Enter old password:<input type=password name=t2 ><br><br>"); out.println("Enter new password:<input type=text name=t3 value='"+c+"'><br><br>"); out.println("Enter confirm password:<input type=text name=t4 value='"+d+"'><br><br>"); out.println("<input type=submit>"); out.println("<input type=reset>"); out.println("</form></center></body></html>"); } } catch(Exception e) { e.printStackTrace();} } public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { Context ic=getInitialContext(); Object ref=ic.lookup("compchangeClient"); compchangeHome hm=(compchangeHome)PortableRemoteObject.narrow(ref,compchangeHome.class); compchangeRemote rmt=hm.create(); PrintWriter out=res.getWriter(); String c_id=req.getParameter("t1"); String old_pwd=req.getParameter("t2"); String new_pwd=req.getParameter("t3"); String conf_pwd=req.getParameter("t4"); Vector v1=new Vector(); v1.addElement(c_id); v1.addElement(old_pwd);

v1.addElement(new_pwd); v1.addElement(conf_pwd); rmt.getChange(v1,req,res); out.println("<html><head></head>"); out.println("<body>"); out.println("Hello!"); out.println("</body></html>"); rmt.remove();

} catch(java.rmi.RemoteException e) { System.out.println("Remote exception:"+e); } catch(javax.ejb.CreateException e) { System.out.println("Create exception:"+e); } catch(javax.ejb.RemoveException e) { System.out.println("Remove exception:"+e); } catch(javax.naming.NamingException e) { System.out.println("Naming exception:"+e); } } private static Context getInitialContext()throws NamingException { System.out.println("we r in private........"); Context ctx=null; try { //System.out.println("we r in try block.........."); Properties h= new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL,"t3://localhost:7001");

ctx=new InitialContext(h); } catch(Exception ne) { System.out.println("exception in ic:"+ne); } return ctx; } } Home Interface: import javax.ejb.*; import java.rmi.*; import java.util.*; public interface compchangeHome extends EJBHome { public compchangeRemote create() throws java.rmi.RemoteException, javax.ejb.CreateException; } Remote Interface: import javax.ejb.*; import javax.servlet.*; import javax.servlet.http.*; //import java.rmi.*; import java.rmi.RemoteException; import java.util.*; //for vector import java.io.*; public interface compchangeRemote extends EJBObject { public void getChange(Vector v,HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException,java.rmi.RemoteException; } Bean: import javax.ejb.*; import java.sql.*; import javax.sql.*; import java.util.*;

import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.naming.*; public class compchangeBean implements SessionBean { SessionContext ctx=null; Connection con=null; Statement stat=null; ResultSet rs=null; public void ejbCreate() //used defined method { } public void getchange(Vector v, HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException //(3) { try { HttpSession ses=req.getSession(true); String cid=""+v.elementAt(0); String opwd=""+v.elementAt(1); String npwd=""+v.elementAt(2); String cpwd=""+v.elementAt(3); InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); con=ds.getConnection(); stat=con.createStatement(); String qry="select * from comp_regs where cid='"+cid+"'"; System.out.println("qry :"+qry); ResultSet rs=stat.executeQuery(qry); if(rs.next()) { if(npwd.equalsIgnoreCase(cpwd)) { String qry1="update u_comps set cpwd='"+npwd+"' where cpwd='"+opwd+"'" ; int i=stat.executeUpdate(qry1); System.out.println("password updated"); res.setContentType("text/html"); PrintWriter out=res.getWriter(); out.println("<html><head><title>Password Changed</title></head>"); out.println("<body bgcolor=blue>"); out.println("Password successfully changed<br>");

out.println("<a href='http://localhost:7001/home.html'>Home</a>"); out.println("</body></html>"); } else{ System.out.println("sorry mismatched........"); res.sendRedirect("http://localhost:7001/compchangeClient"); } } else{ System.out.println("not member........"); } }catch(Exception e){e.printStackTrace();} }

public void ejbRemove() { } public void ejbPassivate() //(4) { } public void ejbActivate() //(2) { } public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

//(1)

Description :

This servlet is used to to verify whether the user ID exist or not.


Coding: Client: import javax.naming.*; import java.rmi.*; import java.util.*; import java.io.*; import javax.rmi.PortableRemoteObject; import javax.servlet.*; import javax.ejb.*; import javax.servlet.http.*;

public class ulogClient extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { String uid=req.getParameter("T1"); String pwd=req.getParameter("T2"); Context ic=getInitialContext(); Object ref=ic.lookup("uloginClient"); ulogHome hm=(ulogHome)PortableRemoteObject.narrow(ref,ulogHome.class); ulogRemote rmt=hm.create(); Vector v1=new Vector(); v1.addElement(uid); v1.addElement(pwd); rmt.loginuser(v1,req,res); rmt.remove(); } catch(java.rmi.RemoteException e) { System.out.println("Remote exception:"+e); } catch(javax.ejb.CreateException e) { System.out.println("Create exception:"+e); } catch(javax.ejb.RemoveException e) { System.out.println("Remove exception:"+e); } catch(javax.naming.NamingException e) { System.out.println("Naming exception:"+e); } } private static Context getInitialContext()throws NamingException { System.out.println("we r in private........"); Context ctx=null; try { //System.out.println("we r in try block..........");

Properties h= new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL,"t3://localhost:7001"); ctx=new InitialContext(h); } catch(Exception ne) { System.out.println("exception in ic:"+ne); } return ctx; } } Home Interface: import javax.ejb.*; public interface ulogHome extends EJBHome { public ulogRemote create() throws java.rmi.RemoteException,javax.ejb.CreateException; } Remote Interface: import javax.ejb.*; import javax.servlet.*; import javax.servlet.http.*; import java.rmi.RemoteException; import java.util.*; //for vector import java.io.*; public interface ulogRemote extends EJBObject { public void loginuser(Vector v,HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException,java.rmi.RemoteException; } Bean: import javax.ejb.*; import java.sql.*; import javax.sql.*;

import java.util.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.naming.*; public class ulogBean implements SessionBean { SessionContext ctx=null; Connection con=null; Statement stat=null; ResultSet rs=null; public void ejbCreate() //used defined method { } public void loginUser(Vector v, HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException //(3) { try { String a=""+v.elementAt(0); String b=""+v.elementAt(1); HttpSession ses=req.getSession(true); InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); con=ds.getConnection(); stat=con.createStatement(); String qry=" select * from u_registration where u_id ='"+a+"' and u_pwd='"+b+"'"; Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(qry); if(rs.next()) { ses.putValue("sumonsession",a); res.sendRedirect("http://localhost:7001/cohello"); } else { res.sendRedirect("http://localhost:7001/home.html"); } }catch(Exception e) { e.printStackTrace(); }

} public void ejbRemove() { } public void ejbPassivate() //(4) { } public void ejbActivate() //(2) { } public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

//(1)

Description:

This web page is used to retrieve the password of the company if he somehow forgot the password.
Coding: Client1:

import java.util.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.ejb.*; import javax.naming.*; import javax.rmi.*; import java.rmi.*; public class compforget1client extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { PrintWriter out=res.getWriter(); res.setContentType("text/html"); HttpSession ses=req.getSession(true); Vector v=new Vector(); v=(Vector)ses.getValue("ram"); if(v==null) { out.println("<html>"); out.println("<head>"); out.println("<title>forgot password</title>"); out.println("</head>"); out.println("<body><center><form method=post action='http://localhost:7001/compforget1client'>"); out.println("enter companyid:<input type=text name=t1><br><br>"); out.println("<input type=submit>"); out.println("</form></center>"); out.println("</body>"); out.println("</html>"); } else { HttpSession se=req.getSession(true); Vector v2=new Vector(); v2=(Vector)se.getValue("ram"); String cid=""+v2.elementAt(0); out.println("<html>"); out.println("<head>"); out.println("<title>forgot password</title>"); out.println("</head>");

out.println("<body><center><form method=post action='http://localhost:7001/compforget1client'>"); out.println("enter companyid:<input type=text name=t1 value='"+cid+"'><br><br>"); out.println("<input type=submit>"); out.println("<b>enter correct userid</b>"); out.println("</form></center>"); out.println("</body>"); out.println("</html>"); } } public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { PrintWriter out=res.getWriter(); res.setContentType("text/html"); String v1=req.getParameter("t1"); HttpSession ses=req.getSession(true); ses.putValue("ram",v1); Context ctx =getInitialContext(); Object ref=ctx.lookup("compforgetclient"); compforgethome home=(compforgethome)PortableRemoteObject.narrow(ref,compforgethome.class); compforgetremote fr=home.create(); fr.forg1(v1,req,res); } catch(Exception d) { d.printStackTrace(); } } private static Context getInitialContext() throws NamingException { Context ctx =null; try { Properties h = new Properties();

h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL, "t3://localhost:7001"); ctx = new InitialContext(h); } catch (Exception ne) { System.out.println("Exception in getting ic "+ne); } return ctx; } }

Client2: import java.util.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.ejb.*; import javax.naming.*; import javax.rmi.*; import java.rmi.*; public class compforgetclient extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { PrintWriter out=res.getWriter(); res.setContentType("text/html"); HttpSession se1=req.getSession(true); Vector v=new Vector(); v=(Vector)se1.getValue("ram"); String cid=""+v.elementAt(0); String secq=""+v.elementAt(1); out.println("<html>");

out.println("<head>"); out.println("<title>forgot password</title>"); out.println("</head>"); out.println("<body><center><form method=post action='http://localhost:7001/compforgetclient'>"); out.println("<input type=hidden name=t value='"+cid+"'>"); out.println("your sec question is:<input type=text name=t1 value='"+secq+"'><br>"); out.println("enter sec answer:<input type=text name=t2><br><br>"); out.println("<input type=submit>"); out.println("</form></center>"); out.println("</body>"); out.println("</html>"); } public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { PrintWriter out=res.getWriter(); res.setContentType("text/html"); String cid=req.getParameter("t"); String a=req.getParameter("t1"); String b=req.getParameter("t2"); Vector v3=new Vector(); v3.addElement(cid); v3.addElement(a); v3.addElement(b); HttpSession se2=req.getSession(true); se2.putValue("seeta",v3); Context ctx =getInitialContext(); Object ref=ctx.lookup("compforgetclient"); compforgethome home=(compforgethome)PortableRemoteObject.narrow(ref,compforgethome.class); compforgetremote ob=home.create(); ob.forg2(v3,req,res); } catch(Exception e) { e.printStackTrace(); }

} private static Context getInitialContext() throws NamingException { Context ctx =null; try { Properties h = new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL, "t3://localhost:7001"); ctx = new InitialContext(h); } catch (Exception ne) { System.out.println("Exception in getting ic "+ne); } return ctx; } } Client 3: import java.util.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.ejb.*; import javax.naming.*; import javax.rmi.*; import java.rmi.*; public class compforget2client extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException { try { System.out.println("Inside try of compforget2client..."); PrintWriter out=res.getWriter(); res.setContentType("text/html"); HttpSession ses=req.getSession(true);

String passwd=(String)ses.getValue("seeta"); out.println("<html>"); out.println("<body>YOUR PASSWORD IS :'"+passwd); out.println("</body>"); out.println("</html>"); } catch(Exception e) { e.printStackTrace(); } } private static Context getInitialContext() throws NamingException { Context ctx =null; try { Properties h = new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL, "t3://localhost:7001"); ctx = new InitialContext(h); } catch (Exception ne) { System.out.println("Exception in getting ic "+ne); } return ctx; } } Home Interface: import javax.ejb.*; public interface compforgethome extends EJBHome { public compforgetremote create() throws java.rmi.RemoteException, javax.ejb.CreateException; }

Remote Interface: import javax.ejb.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public interface compforgetremote extends EJBObject { public void forg1(String v,HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException,RemoteException; public void forg2(Vector v,HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException,RemoteException; } Bean: import java.sql.*; import javax.servlet.http.*; import javax.naming.*; import javax.sql.*; import javax.ejb.*; import javax.servlet.*; import java.util.*; import java.io.*; public class compforgetbean implements SessionBean { SessionContext ctx; Connection conn=null; Statement stmt=null; ResultSet rs=null; public void forg1(String v,HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { System.out.println("forg1 () called......"); String cid=v; System.out.println("companyid :"+cid); try { InitialContext ic=new InitialContext();

DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); conn=ds.getConnection(); stmt=conn.createStatement(); rs=stmt.executeQuery("select sq from comp_regs where cid='"+cid+"'"); if(rs.next()) { System.out.println("in rs.next() forg1........."); String secq=rs.getString("sq"); HttpSession ses1=req.getSession(true); Vector v1=new Vector(); v1.addElement(cid); v1.addElement(secq); ses1.putValue("ram",v1); res.sendRedirect("http://localhost:7001/compforgetclient"); } else { System.out.println("in else forg1........."); HttpSession ses=req.getSession(true); Vector v1=new Vector(); v1.addElement(cid); ses.putValue("ram",v1); res.sendRedirect("http://localhost:7001/compforget1client"); } } catch(Exception e) { e.printStackTrace(); } } public void forg2(Vector v,HttpServletRequest req,HttpServletResponse res) { System.out.println("forg2() called........"); String cid=""+v.elementAt(0); String secq=""+v.elementAt(1); String seca=""+v.elementAt(2); try { InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource");

conn=ds.getConnection(); stmt=conn.createStatement(); rs=stmt.executeQuery("select cpwd from comp_regs where cid='"+cid+"' and sq='"+secq+"'and sa='"+seca+"'"); if(rs.next()) { String password=rs.getString("cpwd"); System.out.println("companypwd :"+password); HttpSession ses2=req.getSession(true); ses2.putValue("seeta",password); res.sendRedirect("http://localhost:7001/compforget2client"); } else { res.sendRedirect("http://localhost:7001/compforgetclient"); } } catch(Exception e) { e.printStackTrace(); } } public void ejbCreate() {} public void ejbRemove() {} public void ejbActivate() {} public void ejbPassivate() {} public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

Description:

This is user registration form.


Coding: Client: import javax.naming.*; import java.rmi.*; import java.util.*; import java.io.*; import javax.rmi.PortableRemoteObject; import javax.servlet.*; import javax.ejb.*; import javax.servlet.http.*; public class regnClient extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { try {

res.setContentType("text/html"); PrintWriter out=res.getWriter(); Vector v=new Vector(); HttpSession ses=req.getSession(true); v=(Vector)ses.getValue("son"); if(v==null) { out.println("<html><head><title>GET REGISTERED</title></head>"); out.println("<body bgcolor=lightpink>"); out.println("Welcome! GET Registered here:"); out.println("<center><form method=Post action='http://localhost:7001/regnClient'>"); out.println("Enter userid:<input type=text name=t1><br><br>"); out.println("Enter password:<input type=password name=t2><br><br>"); out.println("Enter name:<input type=text name=t3 ><br><br>"); out.println("Enter age:<input type=text name=t4 ><br><br>"); out.println("Enter sex:<input type=text name=t5 ><br><br>"); out.println("Enter dob:<input type=text name=t6 ><br><br>"); out.println("Enter add:<input type=text name=t7 ><br><br>"); out.println("Enter phone:<input type=text name=t8 ><br><br>"); out.println("Enter secq:<input type=text name=t9 ><br><br>"); out.println("Enter seca:<input type=text name=t10 ><br><br>"); out.println("<input type=submit>"); out.println("<input type=reset>"); out.println("</form></center></body></html>"); } else { // String b=""+v.elementAt(1); String c=""+v.elementAt(2); String d=""+v.elementAt(3); String e=""+v.elementAt(4); String f=""+v.elementAt(5); String g=""+v.elementAt(6); String h=""+v.elementAt(7); String i=""+v.elementAt(8); String j=""+v.elementAt(9); System.out.println("Filled up form displayed.."); out.println("<html><head><title>Registration Form</title></head>"); out.println("<body bgcolor=blue>"); out.println("<center><form method=post action='http://localhost:7001/regnClient'>"); out.println("Enter ur userid & password"); out.println("Enter userid:<input type=text name=t1><br><br>"); out.println("Enter password:<input type=password name=t2 ><br><br>"); out.println("Enter name:<input type=text name=t3 value='"+c+"'><br><br>");

out.println("Enter age:<input type=text name=t4 value="+d+"><br><br>"); out.println("Enter sex:<input type=text name=t5 value='"+e+"'><br><br>"); out.println("Enter dob:<input type=text name=t6 value='"+f+"'><br><br>"); out.println("Enter add:<input type=text name=t7 value='"+g+"'><br><br>"); out.println("Enter phone:<input type=password name=t8 values="+h+" ><br><br>"); out.println("Enter secq:<input type=text name=t9 value='"+i+"'><br><br>"); out.println("Enter seca:<input type=text name=t10 value='"+j+"'><br><br>"); out.println("<input type=submit>"); out.println("<input type=reset>"); out.println("</form></center></body></html>"); } } catch(Exception e) { e.printStackTrace();} } public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { Context ic=getInitialContext(); System.out.println("ready to lookup"); Object ref=ic.lookup("regnClient"); System.out.println("lookup done...."); regnHome hm=(regnHome)PortableRemoteObject.narrow(ref,regnHome.class); regnRemote rmt=hm.create(); PrintWriter out=res.getWriter(); String u_id=req.getParameter("t1"); String u_pwd=req.getParameter("t2"); String u_name=req.getParameter("t3"); String u_age=req.getParameter("t4"); String u_sex=req.getParameter("t5"); String u_dob=req.getParameter("t6"); String u_add=req.getParameter("t7"); String cont_no=req.getParameter("t8"); String sec_q=req.getParameter("t9"); String sec_a=req.getParameter("t10"); Vector v1=new Vector(); v1.addElement(u_id); v1.addElement(u_pwd); v1.addElement(u_name);

v1.addElement(u_age); v1.addElement(u_sex); v1.addElement(u_dob); v1.addElement(u_add); v1.addElement(cont_no); v1.addElement(sec_q); v1.addElement(sec_a); rmt.getRegn(v1,req,res); out.println("<html><head></head>"); out.println("<body>"); out.println("Hello! New Member"); out.println("</body></html>"); rmt.remove();

} catch(java.rmi.RemoteException e) { System.out.println("Remote exception:"+e); } catch(javax.ejb.CreateException e) { System.out.println("Create exception:"+e); } catch(javax.ejb.RemoveException e) { System.out.println("Remove exception:"+e); } catch(javax.naming.NamingException e) { System.out.println("Naming exception:"+e); } } private static Context getInitialContext()throws NamingException { System.out.println("we r in private........"); Context ctx=null; try { //System.out.println("we r in try block.........."); Properties h= new Properties();

h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL,"t3://localhost:7001"); ctx=new InitialContext(h); } catch(Exception ne) { System.out.println("exception in ic:"+ne); } return ctx; } } Home Interface: import javax.ejb.*; import java.rmi.*; public interface regnHome extends EJBHome { public regnRemote create() throws java.rmi.RemoteException, javax.ejb.CreateException; } Remote Interface: import javax.ejb.*; import javax.servlet.*; import javax.servlet.http.*; //import java.rmi.*; import java.rmi.RemoteException; import java.util.*; //for vector import java.io.*; public interface regnRemote extends EJBObject { public void getRegn(Vector v,HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException,java.rmi.RemoteException; } Bean: import javax.ejb.*; import java.sql.*;

import javax.sql.*; import java.util.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.naming.*; public class regnBean implements SessionBean { SessionContext ctx=null; Connection con=null; Statement stat=null; ResultSet rs=null; public void ejbCreate() //used defined method { } public void getRegn(Vector v, HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException //(3) { try { HttpSession ses=req.getSession(true); //ses.putValue("son",v); String a=""+v.elementAt(0); String b=""+v.elementAt(1); String c=""+v.elementAt(2); String d=""+v.elementAt(3); String e=""+v.elementAt(4); String f=""+v.elementAt(5); String g=""+v.elementAt(6); String h=""+v.elementAt(7); String i=""+v.elementAt(8); String j=""+v.elementAt(9); System.out.println("Vector is :"+v); InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); con=ds.getConnection(); stat=con.createStatement(); rs=stat.executeQuery("select * from u_registration where u_id='"+a+"'"); System.out.println("Query executed..."); if(rs.next()) { System.out.println("Inside if .."); ses.putValue("son",v); res.sendRedirect("http://localhost:7001/regnClient"); } else

{ System.out.println("Inside else............"); String qry="insert into u_registration values( '"+a+"', '"+b+"', '"+c+"',"+d+",'"+e+"','"+f+"','"+g+"',"+h+",'"+i+"','"+j+"')"; System.out.println("qry :"+qry); int ii=stat.executeUpdate(qry); System.out.println(ii+" Row inserted"); } } catch(Exception e) { e.printStackTrace();} } public void ejbRemove() { } public void ejbPassivate() //(4) { } public void ejbActivate() //(2) { } public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

//(1)

Description :

This page is used to change the password of an existing user.


Copding: Client: import javax.naming.*; import java.rmi.*; import java.util.*; import java.io.*; import javax.rmi.PortableRemoteObject; import javax.servlet.*; import javax.ejb.*; import javax.servlet.http.*; public class changeClient extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { try {

res.setContentType("text/html"); PrintWriter out=res.getWriter(); Vector v=new Vector(); HttpSession ses=req.getSession(true); v=(Vector)ses.getValue("son"); if(v==null) { out.println("<html><head><title>Change Password</title></head>"); out.println("<body bgcolor=lightpink>"); out.println("Welcome! Change Your Password:"); out.println("<center><form method=Post action='http://localhost:7001/changeClient'>"); out.println("Enter userid:<input type=text name=t1><br><br>"); out.println("Enter old password:<input type=password name=t2><br><br>"); out.println("Enter new password:<input type=text name=t3 ><br><br>"); out.println("Enter confirm password:<input type=text name=t4 ><br><br>"); out.println("<input type=submit>"); out.println("<input type=reset>"); out.println("</form></center></body></html>"); } else { String c=""+v.elementAt(2); String d=""+v.elementAt(3); out.println("<html><head><title>Registration Form</title></head>"); out.println("<body bgcolor=blue>"); out.println("<center><form method=post action='http://localhost:7001/changeClient'>"); out.println("Change your password"); out.println("Enter userid:<input type=text name=t1><br><br>"); out.println("Enter old password:<input type=password name=t2 ><br><br>"); out.println("Enter new password:<input type=text name=t3 value='"+c+"'><br><br>"); out.println("Enter confirm password:<input type=text name=t4 value='"+d+"'><br><br>"); out.println("<input type=submit>"); out.println("<input type=reset>"); out.println("<A Href='http://localhost:7001/home.html '>Forget password</A>"); out.println("</form></center></body></html>"); } } catch(Exception e)

{ e.printStackTrace();} } public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { Context ic=getInitialContext(); Object ref=ic.lookup("changeClient"); changeHome hm=(changeHome)PortableRemoteObject.narrow(ref,changeHome.class); changeRemote rmt=hm.create(); PrintWriter out=res.getWriter(); String u_id=req.getParameter("t1"); String old_pwd=req.getParameter("t2"); String new_pwd=req.getParameter("t3"); String conf_pwd=req.getParameter("t4"); Vector v1=new Vector(); v1.addElement(u_id); v1.addElement(old_pwd); v1.addElement(new_pwd); v1.addElement(conf_pwd); rmt.getChange(v1,req,res); out.println("<html><head></head>"); out.println("<body>"); out.println("Hello!"); out.println("</body></html>"); rmt.remove();

} catch(java.rmi.RemoteException e) { System.out.println("Remote exception:"+e); } catch(javax.ejb.CreateException e) { System.out.println("Create exception:"+e);

} catch(javax.ejb.RemoveException e) { System.out.println("Remove exception:"+e); } catch(javax.naming.NamingException e) { System.out.println("Naming exception:"+e); } } private static Context getInitialContext()throws NamingException { System.out.println("we r in private........"); Context ctx=null; try { //System.out.println("we r in try block.........."); Properties h= new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL,"t3://localhost:7001"); ctx=new InitialContext(h); } catch(Exception ne) { System.out.println("exception in ic:"+ne); } return ctx; } } Home Interface: import javax.ejb.*; import java.rmi.*; public interface changeHome extends EJBHome { public changeRemote create() throws java.rmi.RemoteException, javax.ejb.CreateException; }

Remote Interface: import javax.ejb.*; import javax.servlet.*; import javax.servlet.http.*; import java.rmi.RemoteException; import java.util.*; //for vector import java.io.*; public interface changeRemote extends EJBObject { public void getChange(Vector v,HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException,java.rmi.RemoteException; } Bean: import javax.ejb.*; import java.sql.*; import javax.sql.*; import java.util.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.naming.*; public class changeBean implements SessionBean { SessionContext ctx=null; Connection con=null; Statement stat=null; ResultSet rs=null; public void ejbCreate() //used defined method { } public void getChange(Vector v, HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException //(3) { try { HttpSession ses=req.getSession(true); String uid=""+v.elementAt(0); String opwd=""+v.elementAt(1); String npwd=""+v.elementAt(2); String cpwd=""+v.elementAt(3);

InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); con=ds.getConnection(); stat=con.createStatement(); String qry="select * from u_registration where u_id='"+uid+"'"; System.out.println("qry :"+qry); ResultSet rs=stat.executeQuery(qry); if(rs.next()) { if(npwd.equalsIgnoreCase(cpwd)) { String qry1="update u_registration set u_pwd='"+npwd+"' where u_pwd='"+opwd+"'" ; int i=stat.executeUpdate(qry1); System.out.println("password updated"); PrintWriter out=res.getWriter(); out.println("<html><head><title>Password Changed</title></head>"); out.println("<body bgcolor=blue>"); out.println("Password successfully changed<br>"); out.println("<a href='http://localhost:7001/home.html'>Home</a>"); out.println("</body></html>"); } else { System.out.println("sorry mismatched........"); res.sendRedirect("http://localhost:7001/changeClient"); } } else { System.out.println("not member........"); res.sendRedirect("http://localhost:7001/changeClient"); } }catch(Exception e){e.printStackTrace();} } public void ejbRemove() { } public void ejbPassivate() //(4) { } public void ejbActivate() //(2) { } public void setSessionContext(SessionContext ctx)

//(1)

{ this.ctx=ctx; } }

Description:

This web page is used when the user forget his password . So he needs to enter the user ID here.
Coding: Client 1: import java.util.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.ejb.*; import javax.naming.*; import javax.rmi.*; import java.rmi.*;

public class forget1client extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { PrintWriter out=res.getWriter(); res.setContentType("text/html"); HttpSession ses=req.getSession(true); Vector v=new Vector(); v=(Vector)ses.getValue("ram"); if(v==null) { out.println("<html>"); out.println("<head>"); out.println("<title>forgot password</title>"); out.println("</head>"); out.println("<body><center><form method=post action='http://localhost:7001/forget1client'>"); out.println("enter userid:<input type=text name=t1><br><br>"); out.println("<input type=submit>"); out.println("</form></center>"); out.println("</body>"); out.println("</html>"); } else { HttpSession se=req.getSession(true); Vector v2=new Vector(); v2=(Vector)se.getValue("ram"); String userid=""+v2.elementAt(0); out.println("<html>"); out.println("<head>"); out.println("<center><title>forgot password</title></center>"); out.println("</head>"); out.println("<body><center><form method=post action='http://localhost:7001/forget1client'>"); out.println("enter userid:<input type=text name=t1 value='"+userid+"'><br><br>"); out.println("<input type=submit>"); out.println("<b>enter correct userid</b>"); out.println("</form></center>"); out.println("</body>"); out.println("</html>"); } }

public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { PrintWriter out=res.getWriter(); res.setContentType("text/html"); String v1=req.getParameter("t1"); HttpSession ses=req.getSession(true); ses.putValue("ram",v1); Context ctx =getInitialContext(); System.out.println(" ready to lookup ..."); Object ref=ctx.lookup("forgetClient"); System.out.println("lookup done ..."); forgethome home=(forgethome)PortableRemoteObject.narrow(ref,forgethome.class); forgetremote fr=home.create(); fr.forg1(v1,req,res); } catch(Exception d) { d.printStackTrace(); } } private static Context getInitialContext() throws NamingException { Context ctx =null; try { Properties h = new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL, "t3://localhost:7001"); ctx = new InitialContext(h); } catch (Exception ne) { System.out.println("Exception in getting ic "+ne); }

return ctx; } } Client 2: import java.util.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.ejb.*; import javax.naming.*; import javax.rmi.*; import java.rmi.*; public class forgetclient extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { PrintWriter out=res.getWriter(); res.setContentType("text/html"); HttpSession se1=req.getSession(true); Vector v=new Vector(); v=(Vector)se1.getValue("ram"); String userid=""+v.elementAt(0); String secq=""+v.elementAt(1); out.println("<html>"); out.println("<head>"); out.println("<title>forgot password</title>"); out.println("</head>"); out.println("<body><center><form method=post action='http://localhost:7001/forgetclient'>"); out.println("<input type=hidden name=t value='"+userid+"'>"); out.println("your sec question is:<input type=text name=t1 value='"+secq+"'><br>"); out.println("enter sec answer:<input type=text name=t2><br><br>"); out.println("<input type=submit>"); out.println("</form></center>"); out.println("</body>"); out.println("</html>"); }

public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { PrintWriter out=res.getWriter(); res.setContentType("text/html"); String userid=req.getParameter("t"); String a=req.getParameter("t1"); String b=req.getParameter("t2"); Vector v3=new Vector(); v3.addElement(userid); v3.addElement(a); v3.addElement(b); HttpSession se2=req.getSession(true); se2.putValue("seeta",v3); Context ctx =getInitialContext(); Object ref=ctx.lookup("forgetClient"); forgethome home=(forgethome)PortableRemoteObject.narrow(ref,forgethome.class); forgetremote ob=home.create(); ob.forg2(v3,req,res); } catch(Exception e) { e.printStackTrace(); } } private static Context getInitialContext() throws NamingException { Context ctx =null; try { Properties h = new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL, "t3://localhost:7001"); ctx = new InitialContext(h);

} catch (Exception ne) { System.out.println("Exception in getting ic "+ne); } return ctx; } }

Client 3: import java.util.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.ejb.*; import javax.naming.*; import javax.rmi.*; import java.rmi.*; public class forget2client extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException { try { PrintWriter out=res.getWriter(); res.setContentType("text/html"); HttpSession ses=req.getSession(true); String passwd=(String)ses.getValue("seeta"); out.println("<html>"); out.println("<body><center>YOUR PASSWORD IS :'"+passwd+"'"); out.println("</center></body>"); out.println("</html>"); } catch(Exception e) { e.printStackTrace(); } }

private static Context getInitialContext() throws NamingException { Context ctx =null; try { Properties h = new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL, "t3://localhost:7001"); ctx = new InitialContext(h); } catch (Exception ne) { System.out.println("Exception in getting ic "+ne); } return ctx; } } Home Interface: import javax.ejb.*; public interface forgethome extends EJBHome { public forgetremote create() throws java.rmi.RemoteException, javax.ejb.CreateException; } Remote Interface: import javax.ejb.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public interface forgetremote extends EJBObject { public void forg1(String v,HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException,RemoteException;

public void forg2(Vector v,HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException,RemoteException; } Bean: import java.sql.*; import javax.servlet.http.*; import javax.naming.*; import javax.sql.*; import javax.ejb.*; import javax.servlet.*; import java.util.*; import java.io.*; public class forgetbean implements SessionBean { SessionContext ctx; Connection conn=null; Statement stmt=null; ResultSet rs=null; public void forg1(String v,HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { System.out.println("forg1 () called......"); String userid=v; System.out.println("userid :"+userid); try { InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); conn=ds.getConnection(); stmt=conn.createStatement(); rs=stmt.executeQuery("select sec_q from u_registration where u_id='"+userid+"'"); if(rs.next()) { System.out.println("in rs.next()........."); String secq=rs.getString("sec_q"); HttpSession ses1=req.getSession(true); Vector v1=new Vector(); v1.addElement(userid); v1.addElement(secq);

ses1.putValue("ram",v1); res.sendRedirect("http://localhost:7001/forgetclient"); } else { HttpSession ses=req.getSession(true); Vector v1=new Vector(); v1.addElement(userid); ses.putValue("ram",v1); res.sendRedirect("http://localhost:7001/forget1client"); } } catch(Exception e) { e.printStackTrace(); } } public void forg2(Vector v,HttpServletRequest req,HttpServletResponse res) { System.out.println("forg2() called........"); String userid=""+v.elementAt(0); String secq=""+v.elementAt(1); String seca=""+v.elementAt(2); try { InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); conn=ds.getConnection(); stmt=conn.createStatement(); rs=stmt.executeQuery("select u_pwd from u_registration where u_id='"+userid+"' and sec_q='"+secq+"'and sec_a='"+seca+"'"); if(rs.next()) { String password=rs.getString("u_pwd"); System.out.println("userpwd :"+password); HttpSession ses2=req.getSession(true); ses2.putValue("seeta",password); res.sendRedirect("http://localhost:7001/forget2client"); }

else { res.sendRedirect("http://localhost:7001/forgetclient"); } } catch(Exception e) { e.printStackTrace(); } } public void ejbCreate() {} public void ejbRemove() {} public void ejbActivate() {} public void ejbPassivate() {} public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

Description :

This web page is used to select the category of the product like automobile, books, computers etc.
Coding: Client 1: <html> <head><title>product catagory</title> </head> <body bgcolor=wheat> <H1><tt><p align=center><font size=6><B><u>Product Catagory Form</u></B></font></p></tt><H1> <pre> </pre> <form method =post action='http://localhost:7001/plogclient'> <table border=0> <tr><td><b>Product Type</b></td> <td><SELECT class=textboxes1 name=T1 width=50>

<OPTION value=automobile>automobile</OPTION> <OPTION value=computers>computers</OPTION> <OPTION value=garments>garments</OPTION> <OPTION value=furniture>furniture</OPTION> <OPTION value=jwellary>jwellary</OPTION> </td> </tr> <tr> <td></td> </tr> <tr> <td><input type=submit name=b1</td> </tr> </table> </form> </body> </html> Client 2:

When the user choose a product category this servlet is called.


import javax.naming.*; import java.rmi.*; import java.util.*; import java.io.*; import javax.rmi.PortableRemoteObject; import javax.servlet.*; import javax.ejb.*; import javax.servlet.http.*; public class plogclient extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { try { String ptype=req.getParameter("T1"); Context ic=getInitialContext(); System.out.println("Value of ptype inside client is : "+ptype); Object ref=ic.lookup("plogclient"); ploghome hm=(ploghome)PortableRemoteObject.narrow(ref,ploghome.class); plogremote rmt=hm.create();

Vector v1=new Vector(); v1.addElement(ptype); rmt.plog(v1,req,res); rmt.remove(); } catch(java.rmi.RemoteException e) { System.out.println("Remote exception:"+e); } catch(javax.ejb.CreateException e) { System.out.println("Create exception:"+e); } catch(javax.ejb.RemoveException e) { System.out.println("Remove exception:"+e); } catch(javax.naming.NamingException e) { System.out.println("Naming exception:"+e); } } private static Context getInitialContext()throws NamingException { System.out.println("we r in private........"); Context ctx=null; try { //System.out.println("we r in try block.........."); Properties h= new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL,"t3://localhost:7001"); ctx=new InitialContext(h); } catch(Exception ne) { System.out.println("exception in ic:"+ne); } return ctx; } }

Home Interface: import javax.ejb.*; public interface ploghome extends EJBHome { public plogremote create() throws java.rmi.RemoteException,javax.ejb.CreateException; } Remote Interface: import javax.ejb.*; import javax.servlet.*; import javax.servlet.http.*; import java.rmi.RemoteException; import java.util.*; //for vector import java.io.*; public interface plogremote extends EJBObject { public void plog(Vector v,HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException,java.rmi.RemoteException; } Bean: import javax.ejb.*; import java.sql.*; import javax.sql.*; import java.util.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.naming.*; public class plogbean implements SessionBean { SessionContext ctx=null; Connection con=null; Statement stat=null; ResultSet rs=null; public void ejbCreate() //used defined method { }

public void plog(Vector v, HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException //(3) { try { String a=""+v.elementAt(0); InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); con=ds.getConnection(); stat=con.createStatement(); System.out.println("Value inside the vector is : "+a); rs=stat.executeQuery("select catid from catreg where catname='"+a+"'"); if(rs.next()) { String catagory=rs.getString("catid"); HttpSession ses=req.getSession(true); ses.putValue("cata",catagory); System.out.println("inside if....."); if(category=1111) { System.out.println("Ready to move to alogclient servlet..."); res.sendRedirect("http://localhost:7001/alogclient"); } else if(category=2222) { System.out.println("Ready to move to booksclient servlet..."); res.sendRedirect("http://localhost:7001/booksclient"); } if(category=3333) { System.out.println("Ready to move to artsclient servlet..."); res.sendRedirect("http://localhost:7001/artsclient"); } } else { System.out.println("inside else.........."); System.out.println("Ready to move to ptype.html file......"); res.sendRedirect("http://localhost:7001/ptype.html"); } } catch(Exception e) { e.printStackTrace();} }

public void ejbRemove() { } public void ejbPassivate() //(4) { } public void ejbActivate() //(2) { } public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

//(1)

Description :

This is the product registration form. User needs to enter the details of the product and the product ID is generated and is displayed.
Coding: Cient: import javax.servlet.*; import javax.servlet.http.*;

import java.io.*; import java.sql.*; import java.util.*; import javax.naming.*; import java.rmi.*; import javax.ejb.*; import javax.rmi.PortableRemoteObject; public class alogclient extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException { try { HttpSession ses=req.getSession(true); String a=(String)ses.getValue("cata"); String b=(String)ses.getValue("cologinClient"); System.out.println("category ID "+a); System.out.println("Company ID : "+b); PrintWriter out=res.getWriter(); res.setContentType("text/html"); out.println("<html><head><title>Automobile Form</title></head><body bgcolor='wheat'><center>"); out.println("<form method=post action='http://localhost:7001/alogclient'"); out.println("<table boder=0>"); //out.println("<tr><td>pid</td><input type=text name='t1'></tr>"); out.println("<input type=hidden name=t2 value="+b+"></tr>"); out.println("<input type=hidden name=t3 value="+a+"></tr>"); out.println("<tr><td>Brand Name</td><td><input type=text name='t4'><br></td></tr><br>"); out.println("<tr><td>Stoke</td><td><input type=text name='t5'><br></td></tr><br>"); out.println("<tr><td>Model</td><td><input type=text name='t6'><br></td></tr><br>"); out.println("<tr><td>Average</td><td><input type=text name='t7'><br></td></tr><br>"); out.println("<tr><td>Color</td><td><input type=text name='t8'><br></td></tr><br>"); out.println("<tr><td>Hand</td><td><input type=text name='t9'><br></td></tr><br>"); out.println("<tr><td>Insurance</td><td><input type=text name='t10'><br></td></tr><br>"); out.println("<tr><td>Price</td><td><input type=text name='t11'><br></td></tr><br>"); out.println("<tr><td>Product Name</td><td><input type=text name='t12'><br></td>td</tr><br>"); out.println("<tr><td>Quantity</td><td><input type=text name='t13'><br></td></tr><br>"); out.println("<input type =submit name=b3>");

out.println("</form></table></center></body></html>"); } catch(Exception e) { e.printStackTrace(); } } public void doPost(HttpServletRequest req ,HttpServletResponse res) throws ServletException,IOException { try { Context ic=getInitialContext(); System.out.println("Ready to lookup alogclient..."); Object ref=ic.lookup("alogclient"); System.out.println("lookup done..."); aloghome hm=(aloghome)PortableRemoteObject.narrow(ref,aloghome.class); alogremote rmt=hm.create(); //String pid=req.getParameter("t1"); String cid=req.getParameter("t2"); String catid=req.getParameter("t3"); String bname=req.getParameter("t4"); String stoke=req.getParameter("t5"); String model=req.getParameter("t6"); String avg=req.getParameter("t7"); String color=req.getParameter("t8"); String hand=req.getParameter("t9"); String insstatus=req.getParameter("t10"); String price=req.getParameter("t11"); String pname=req.getParameter("t12"); String qty=req.getParameter("t13"); Vector v1=new Vector(); //v1.addElement(pid); v1.addElement(cid); v1.addElement(catid); v1.addElement(bname); v1.addElement(stoke); v1.addElement(model); v1.addElement(avg); v1.addElement(color); v1.addElement(hand); v1.addElement(insstatus); v1.addElement(price); v1.addElement(pname); v1.addElement(qty); rmt.alog(v1,req,res);

rmt.remove(); } catch(java.rmi.RemoteException e) { System.out.println("Remote exception:"+e); } catch(javax.ejb.CreateException e) { System.out.println("Create exception:"+e); } catch(javax.ejb.RemoveException e) { System.out.println("Remove exception:"+e); } catch(javax.naming.NamingException e) { System.out.println("Naming exception:"+e); } } private static Context getInitialContext()throws NamingException { System.out.println("we r in private........"); Context ctx=null; try { //System.out.println("we r in try block.........."); Properties h= new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor y"); h.put(Context.PROVIDER_URL,"t3://localhost:7001"); ctx=new InitialContext(h); } catch(Exception ne) { System.out.println("exception in ic:"+ne); } return ctx; } }

Home Interface: import javax.ejb.*; public interface aloghome extends EJBHome { public alogremote create() throws java.rmi.RemoteException,javax.ejb.CreateException; } Remote Interface: import javax.ejb.*; import javax.servlet.*; import javax.servlet.http.*; import java.rmi.RemoteException; import java.util.*; //for vector import java.io.*; public interface alogremote extends EJBObject { public void alog(Vector v,HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException,java.rmi.RemoteException; } Bean: import javax.ejb.*; import java.sql.*; import javax.sql.*; import java.util.*; import java.rmi.*; import javax.servlet.*; import javax.servlet.http.*;

import java.io.*; import javax.naming.*; public class alogbean implements SessionBean { SessionContext ctx=null; Connection con=null; Statement stat=null; ResultSet rs=null; public void ejbCreate() //used defined method { } public void alog(Vector v, HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException //(3) { try { String a=""+v.elementAt(0); String b=""+v.elementAt(1); String c=""+v.elementAt(2); String d=""+v.elementAt(3); String e=""+v.elementAt(4); String f=""+v.elementAt(5); String g=""+v.elementAt(6); String h=""+v.elementAt(7); String i=""+v.elementAt(8); String j=""+v.elementAt(9); String k=""+v.elementAt(10); String l=""+v.elementAt(11); System.out.println("Vector in bean "+v); InitialContext ic=new InitialContext(); DataSource ds=(javax.sql.DataSource)ic.lookup("Mydatasource"); con=ds.getConnection(); stat=con.createStatement(); System.out.println("values ready to insert ............"); String qry="insert into automobile values(p_seq.nextval,'"+a+"', '"+b+"','"+c+"', '"+d+"','"+e+"','"+f+"','"+g+"','"+h+"','"+i+"','"+j+"', '"+k+"', '"+l+"')"; System.out.println("qry :"+qry); int ii=stat.executeUpdate(qry); con.commit(); rs=stat.executeQuery("select * from automobile where pid=p_seq.currval"); if (rs.next()) { String pid=rs.getString("pid"); System.out.println("Product id is "+pid); PrintWriter out=res.getWriter(); res.setContentType("text/html");

out.println("<html><head><title>Product ID</title></head><body bgcolor='wheat'>"); out.println("Your product ID is "+pid); out.println("<a href='http://localhost:7001/cohello'>Welcome Page</a>"); out.println("</body></html>"); } } catch(Exception e) { e.printStackTrace();} } public void ejbRemove() { } public void ejbPassivate() //(4) { } public void ejbActivate() //(2) { } public void setSessionContext(SessionContext ctx) { this.ctx=ctx; } }

//(1)

Description:

Product ID is generated and is displayed.