Professional Documents
Culture Documents
Online Auction
Online Auction
_______________
_______________
In Partial Fulfillment of the Requirements for the Degree Master of Science in Computer Science
_______________
iii
iv
DEDICATION
To all.
vi
TABLE OF CONTENTS
PAGE ABSTRACT...............................................................................................................................v LIST OF TABLES.....................................................................................................................x LIST OF FIGURES ................................................................................................................. xi CHAPTER 1 INTRODUCTION .........................................................................................................1 1.1 Overview............................................................................................................2 1.1 No of Modules ...................................................................................................2 1.2 Description for Modules ....................................................................................3 1.2.1 Admin Module ..........................................................................................3 1.2.2 Seller Module............................................................................................3 1.2.3 Buyer Module ...........................................................................................3 1.2.4 Visitor Module ..........................................................................................3 1.2.5 Security and Authentication......................................................................3 1.2.6 Reports ......................................................................................................3 2 RESEARCH & TECHNOLOGY ..................................................................................4 2.1 Research .............................................................................................................4 2.1.1 Existing System ........................................................................................4 2.1.2 Proposed System.......................................................................................4 2.1.3 Requirements ............................................................................................5 2.2 Technology Description.....................................................................................5 2.2.1 HTML .......................................................................................................5 2.2.1.1 Hyper Text Markup Language.........................................................5 2.2.1.2 Attributes..........................................................................................6 2.2.1.3 Advantages.......................................................................................6 2.2.2 JavaScript..................................................................................................6 2.2.2.1 JavaScript Vs Java ...........................................................................7 2.2.2.2 Advantages.......................................................................................7
vii 2.2.3 Java Technology .......................................................................................7 2.2.3.1 Importance of Java to the Internet ...................................................7 2.2.3.2 Java can be Used to Create Two Types of Programs.......................8 2.2.3.3 Features of Java Security .................................................................8 2.2.3.4 Portability.........................................................................................8 2.2.3.5 The Byte Code .................................................................................8 2.2.3.6 Java Virtual Machine (JVM) ...........................................................9 2.2.3.7 Java Architecture .............................................................................9 2.2.3.8 Compilation of Code........................................................................9 2.2.3.9 Simple ............................................................................................10 2.2.3.10 Object-Oriented............................................................................10 2.2.3.11 Robust ..........................................................................................10 2.2.4 Java Database Connectivity ....................................................................10 2.2.4.1 JDBC ver. ODBC and other API ...................................................10 2.2.4.2 Two-Tier and Three-Tier Models ..................................................11 2.2.4.3 JDBC Driver Types........................................................................11 2.2.4.4 JDBC-ODBC Bridge .....................................................................12 2.2.5 JDBC Connectivity .................................................................................12 2.2.5.1 Database.........................................................................................12 2.2.5.2 Description.....................................................................................12 2.2.6 SQL.........................................................................................................13 2.2.6.1 Data ................................................................................................13 2.2.6.2 Data Manipulation .........................................................................13 2.2.7 Servlets....................................................................................................13 2.2.7.1 Attractiveness of Servlets ..............................................................14 2.2.7.2 Advantages of the Servlet API.......................................................14 2.2.7.3 Features of Servlets........................................................................14 2.2.7.4 Loading Servlets ............................................................................15 2.2.7.5 Loading Remote Servlets...............................................................15 2.2.7.6 Invoking Servlets ...........................................................................15 2.2.7.7 Java Server Pages (JSP) .................................................................16 2.2.7.8 Features of JSP...............................................................................16
viii 2.2.8 Struts .......................................................................................................17 2.2.8.1 Elements of a Web Application .....................................................17 2.2.8.2 JSP Model 1 and Model 2 Architectures .......................................18 2.2.8.3 The MVC Model............................................................................19 2.2.8.4 MVC View.....................................................................................19 2.2.8.5 MVC Controller .............................................................................20 2.2.8.6 Framework .....................................................................................20 2.2.8.7 Creation of the Struts Framework..................................................21 2.2.8.8 The Struts Component Packages ...................................................21 2.2.8.9 Struts Controller Components .......................................................21 2.2.8.10 Struts ActionServlet .....................................................................21 2.2.8.11 Struts Action Classes ...................................................................22 2.2.8.12 Mapping the Actions....................................................................22 2.2.8.13 Determining the Next View .........................................................22 2.2.8.14 Struts Model Components............................................................22 2.2.8.15 Using the Struts ActionForm .......................................................23 2.2.8.16 Using JavaServer Pages for Presentation.....................................23 2.2.8.17 Message Resource Bundles..........................................................24 2.2.8.18 Multiple Application Support ......................................................24 2.2.8.19 Configuring the Struts Application..............................................24 2.2.8.20 ActionForms and Scope...............................................................25 3 METHOD ....................................................................................................................26 3.1 The ActionForm validate() Method .................................................................26 3.1.1 The ActionForm reset() Method .............................................................27 3.1.2 Declaring ActionForms in the Struts Configuration File.......................28 3.1.3 Declaring ActionForm Properties as Strings ..........................................28 3.1.4 Using ActionErrors .................................................................................28 3.1.5 Struts Built-in Actions ............................................................................31 3.1.6 Forward Action .......................................................................................32 3.1.7 Include Action.........................................................................................32 3.1.8 Switch Action..........................................................................................32 3.1.9 Dispatch Action ......................................................................................32
ix 3.1.9.1 Steps to use DispatchAction Class.................................................33 3.1.9.2 Creating Action Class ....................................................................33 3.1.9.3 Configuring Action Mapping.........................................................33 3.2 Scope of the Development Project...................................................................33 3.2.1 Environment............................................................................................34 3.2.2 Product Features......................................................................................34 3.3 Data Flow.........................................................................................................34 3.4 Data Flow Diagrams ........................................................................................35 3.5 Unified Modeling Language (UML) Diagrams..............................................40 3.5.1 User Model View....................................................................................40 3.5.2 Structural Model View............................................................................40 3.5.3 Behavioral Model View..........................................................................41 3.5.4 Implementation Model View ..................................................................41 3.5.5 Environmental Model View....................................................................41 3.5.6 Collaboration Diagram............................................................................46 3.5.7 Operation Level Sequence Diagrams......................................................47 3.5.8 Operational Level Collaboration Diagrams ............................................47 3.5.9 Activity Diagram ....................................................................................47 4 TESTING.....................................................................................................................52 4.1 Software Testing ..............................................................................................52 4.2 History..............................................................................................................54 5 FUTURE ENHANCEMENTS ANDCONCLUSION.................................................57 5.1 Limitations of the System ................................................................................57 5.2 Future Enhancements.......................................................................................57 5.3 Work Done.......................................................................................................57 REFERENCES ........................................................................................................................59 APPENDIX CODE...........................................................................................................................60
LIST OF TABLES
PAGE Table 4.1. Performance Table..................................................................................................54
xi
LIST OF FIGURES
PAGE Figure 2.1. JSP model architecture. .........................................................................................18 Figure 3.1. Flow process..........................................................................................................34 Figure 3.2. Process...................................................................................................................35 Figure 3.3. Source of data. .......................................................................................................35 Figure 3.4. Data storage diagram indicator..............................................................................35 Figure 3.5. Data flow diagram which illustrates entire flow in the process. ...........................36 Figure 3.6. Authentication data flow diagram. ........................................................................37 Figure 3.7. Level 1 data flow diagram for Admin. ..................................................................37 Figure 3.8. Level 2 data flow diagram for Admin. ..................................................................37 Figure 3.9. Level 3 data flow diagram for Admin. ..................................................................38 Figure 3.10. Level 4 data flow diagram for Admin. ................................................................38 Figure 3.11. Level 1 data flow diagram for seller....................................................................38 Figure 3.12. Level 2 data flow diagram for Seller. ..................................................................39 Figure 3.13. Level 1 data flow diagram for Buyer. .................................................................39 Figure 3.14. Level 2 data flow diagram. ..................................................................................39 Figure 3.15. Entity- Relationship flow which explains the relationship in data......................40 Figure 3.16. UML diagram of the work...................................................................................42 Figure 3.17. System use case diagram. ....................................................................................43 Figure 3.18. Admin use case diagram......................................................................................43 Figure 3.19. Buyer/Seller (Customer) use case diagram. ........................................................44 Figure 3.20. Login ->Validate Login->View Customers->View Bid Items->view Auction items today and end day.................................................................................44 Figure 3.21. Buyer/seller (Customer) Sequence Diagram. Login ->Validate Login>Bid Item->Sell Item->view Auction items today and end day. .................................45 Figure 3.22. Admin collaboration diagram..............................................................................46 Figure 3.23. Customer (buyer/Seller) collaboration diagram. .................................................46 Figure 3.24. Login sequence diagram......................................................................................48 Figure 3.25. Login collaboration diagram. ..............................................................................48
xii Figure 3.26. Administrator activity diagram............................................................................49 Figure 3.27. Seller (Owner of the Article or customer) activity diagram................................50 Figure 3.28. Buyer (Registered Bidder or customer) activity diagram....................................51
CHAPTER 1 INTRODUCTION
An Auction is Latin work which means augment. Auction is a bid, a process of selling; buying and services offered take place. There are several different types of auctions and certain rules exist for each auction. There are variations for an auction which may include minimum price limit, maximum price limit and time limitations etc. Depending upon the auction method bidder can participate remotely or in person. Remote auction include participating through telephone, mail, and internet. Shopping online has widely grown; online auction system is increasing rapidly. Online auction is becoming more and more popular in electronic commerce and hence it should system must increase its quality and security. The online auction system is a model where we participate in a bid for products and service. This auction is made easier by using online software which can regulate processes involved. There are several different auction methods or types and one of the most popular methods is English auction system. This system has been designed to be highly-scalable and capable of supporting large numbers of bidders in an active auction. Online Auctioning System has several other names such as e-Auctions, electronic auction etc. The requirement for online auction or online bidding can be more accurately specified by the client. It should be healthy and will be a good practice when it is made more transparent as a matter of fact. Online Bidding has become more wide spread in all sorts of industrial usage. It not only includes the product or goods to be sold, it also has services which can be provided. Due to their low cost this expansion made the system to grow. Online bidding has become a standard method for procurement process. Bidders can be maintained in a single database according to the preference, and they can be monitored. Users data can be maintained in a confidential way for validity and integrity of contractual documentation. Neat reporting reduces paperwork, postage, photocopying and time
2 beneficial. Multiple bidders can be communicated with a great ease. This system allows multiple bids by single users. Online bidding is based upon lowest or the highest price which is initiated but not the best value for the product. Although there is a chance to fix the criteria against the fact expected to have desired value by the seller.
1.1 OVERVIEW
The Objective is to develop a user-friendly auctioning site where any kind of product can be auctioned and provide value-added services to the bidders and the sellers. The products will be authenticated and the site provides a safe environment for online users: Secure registration of all users including a personal profile Administrators would authorize the product to auction, set auction dates and Minimum auction amount for that product. Prior to each bid, the users bank or credit account must be authenticated for available balance required for the bid. Complete Search/Site Map of the entire site for easy access. Discussion forums for users to interact with other users to know about the products value and originality. Online Legal Documentation to avoid disputes. Guidance to the users about the same must be available. Rare articles may be withheld by owner on the advice of the administrator to be thrown open in special auctions held by the site so as to increase the bid-values.
1.1 NO OF MODULES
The system after careful analysis has been identified to be presented with the following modules: Admin Module. Seller Module. Buyer Module. Visitor Module. Security and authentication. Reports.
1.2.6 Reports
In this module, different actors can generate the different types of reports according to their access.
2.1 RESEARCH
Research includes what existing system is and the purpose of the system.
5 Administrators would authorize the product to auction, set auction dates & minimum auction amount for that product. Prior to each bid, the users bank or credit account must be authenticated for available balance required for the bid. Users can select their interested fields for bidding and periodic Mail alerts must be sent in case an article in that field goes on auction. Complete Search/Site Map of the entire site for easy access.
2.1.3 Requirements
The Objective is to develop a user-friendly auctioning site where any kind of product can be auctioned and provide value-added services to the bidders and the sellers. The products will be authenticated and the site provides a safe environment for online users: Secure registration of all users including a personal profile. Prior to each bid, the users bank or credit account must be authenticated for. Available balance required for the bid. Complete Search/Site Map of the entire site for easy access.
2.2.1 HTML
HTML, an initialize of Hypertext Markup Language, is the predominant markup language for web pages. It provides a means to describe the structure of text-based information in a document by denoting certain text as headings, paragraphs, lists, and so on and to supplement that text with interactive forms, embedded images, and other objects.
6 HTML can be used to display any type of document on the host computer, which can be geographically at a different location. It is a versatile language and can be used on any platform or desktop. HTML provides tags (special codes) to make the document look attractive. HTML tags are not case-sensitive. Using graphics, fonts, different sizes, color, etc., can enhance the presentation of the document. Anything that is not a tag is part of the document itself.
2.2.1.2 ATTRIBUTES
The attributes of an element are name-value pairs, separated by "=", and written within the start label of an element, after the element's name. The value should be enclosed in single or double quotes, although values consisting of certain characters can be left unquoted in HTML (but not XHTML).Leaving attribute values unquoted is considered unsafe. Most elements take any of several common attributes: id, class, style and title. Most also take language-related attributes: language and dir.
2.2.1.3 ADVANTAGES
The advantages include: A HTML document is small and hence easy to send over the net. It is small because it does not include formatted information. HTML is platform independent. HTML tags are not case-sensitive.
2.2.2 JavaScript
JavaScript is a script-based programming language that was developed by Netscape Communication Corporation. JavaScript was originally called Live Script and renamed as JavaScript to indicate its relationship with Java. JavaScript supports the development of both client and server components of Web-based applications. On the client side, it can be used to write programs that are executed by a Web browser within the context of a Web page. On the server side, it can be used to write [11] Web server programs that can process information submitted by a Web browser and then update the browsers display accordingly.
There are many other differences but the important thing to remember is that JavaScript and Java are separate languages. They are both useful for different things; in fact they can be used together to combine their advantages.
2.2.2.2 ADVANTAGES
The advantages include: JavaScript can be used for Sever-side and Client-side scripting. It is more flexible than VBScript. JavaScript is the default scripting languages at Client-side since all the browsers supports it.
8 information and Dynamic active programs. The Dynamic, Self-executing programs cause serious problems in the areas of Security and probability [7].
2.2.3.4 PORTABILITY
For programs to be dynamically downloaded to all the various types of platforms connected to the Internet, some means of generating portable executable code is needed .As you will see, the same mechanism that helps ensure security also helps create portability. Indeed, Javas solution to these two problems is both elegant and efficient [6,9].
9 compiles byte code into executable code in real time, on a piece-by-piece, demand basis. It is not possible to compile an entire Java program into executable code all at once, because Java performs various run-time checks that can be done only at run time. The JIT compiles code, as it is needed, during execution [1].
10
2.2.3.9 SIMPLE
Java was designed to be easy for the Professional programmer to learn and to use effectively. If you are an experienced C++ programmer, learning Java will be even easier. Because Java inherits the C/C++ syntax and many of the object oriented features of C++.
2.2.3.10 OBJECT-ORIENTED
Java was not designed to be source-code compatible with any other language. This allowed the Java team the freedom to design with a blank slate. One outcome of this was a clean usable, pragmatic approach to objects. The object model in Java is simple and easy to extend, while simple types, such as integers, are kept as high-performance non-objects.
2.2.3.11 ROBUST
The multi-platform environment of the Web places extraordinary demands on a program, because the program must execute reliably in a variety of systems. The ability to create robust programs was given a high priority in the design of Java. Java is strictly typed language; it checks your code at compile time and run time.
11 So why not just use ODBC from Java? The answer is that can use ODBC from Java, but this is best done with the help of JDBC in the form of the JDBC-ODBC Bridge, which we will cover shortly. The question now becomes "Why do you need JDBC?" There are several answers to this question: ODBC is not appropriate for direct use from Java because it uses a C interface. Calls from Java to native C code have a number of drawbacks in the security, implementation, robustness, and automatic portability of applications. A literal translation of the ODBC C API into a Java API would not be desirable. For example, Java has no pointers, and ODBC makes copious use of them, including the notoriously error-prone generic pointer "void *". You can think of JDBC as ODBC translated into an object-oriented interface that is natural for Java programmers. ODBC is hard to learn. It mixes simple and advanced features together, and it has complex options even for simple queries. JDBC, on the other hand, was designed to keep simple things simple while allowing more advanced capabilities where required. A Java API like JDBC is needed in order to enable a "pure Java" solution. When ODBC is used, the ODBC driver manager and drivers must be manually installed on every client machine. When the JDBC driver is written completely in Java, however, JDBC code is automatically installable, portable, and secure on all Java platforms from network computers to mainframes.
12 Native-API partly-Java driver. JDBC-Net pure Java driver. Native-protocol pure Java driver.
2.2.5.1 DATABASE
A database management system (DBMS) is computer software designed for the purpose of managing databases, a large set of structured data, and run operations on the data requested by numerous users. Typical examples of DBMSs include Oracle, DB2, Microsoft Access, Microsoft SQL Server, Firebird, PostgreSQL, MySQL, SQLite, FileMaker and Sybase Adaptive Server Enterprise. DBMSs are typically used by Database administrators in the creation of Database systems. Typical examples of DBMS use include accounting, human resources and customer support systems.
2.2.5.2 DESCRIPTION
A DBMS is a complex set of software programs that controls the organization, storage, management and retrieval of data in a database. A DBMS includes:
13 A modeling language to define the schema of each database hosted in the DBMS, according to the DBMS data model. The four most common types of organizations are the hierarchical, network, relational and object models. Inverted lists and other methods are also used. A given database management system may provide one or more of the four models. The optimal structure depends on the natural organization of the application's data, and on the application's requirements (which include transaction rate (speed), reliability, maintainability, scalability, and cost).
2.2.6 SQL
Structured Query Language (SQL) is the language used to manipulate relational databases. SQL is tied very closely with the relational model. In the relational model, data is stored in structures called relations or tables. SQL statements are issued for the purpose of: Data definition: Defining tables and structures in the database (DDL used to create, alter and drop schema objects such as tables and indexes). Data manipulation: Used to manipulate the data within those schema objects (DML Inserting, Updating, Deleting the data, and Querying the Database).
2.2.6.1 DATA
Defining tables and structures in the database (DDL used to create, alter and drop schema objects such as tables and indexes).
2.2.7 Servlets
The Java web server is Java Softs own web Server. The Java web server is just a part of a larger framework, intended to provide you not just with a web server, but also with tools. To build customized network servers for any Internet or Intranet client/server system. Servlets are to a web server, how applets are to the browser. About Servlets: Servlets provide a Java-based solution used to address the problems currently associated with doing server-side programming, including inextensible scripting solutions, platform-specific APIs, and incomplete interfaces.
14 Servlets are objects that conform to a specific interface that can be plugged into a Java-based server. Servlets are to the server-side what applets are to the client-side object byte codes that can be dynamically loaded off the net. They differ from applets in that they are faceless objects (without graphics or a GUI component).
15 Servlets are platform independent. Servlets are extensible. Java is a robust, object-oriented programming language, which easily can be extended to suit your needs. Servlets are secure. Servlets can be used with a variety of clients.
16
17 The client sends a request to the web server for a JSP file by giving the name of the JSP file within the form tag of a HTML page. This request is transferred to the JavaWebServer. At the server side JavaWebServer receives the request and if it is a request for a jsp file server gives this request to the JSP engine. JSP engine is program which can under stands the tags of the jsp and then it converts those tags into a Servlet program and it is stored at the server side. This Servlet is loaded in the memory and then it is executed and the result is given back to the JavaWebServer and then it is transferred back to the result is given back to the JavaWebServer and then it is transferred back to the client.
2.2.8 Struts
Applications built using the Struts framework are at their core, web applications. A web application is a collection of individual components that once bound together, form a complete application that can be installed and executed by a web container. The components are tied together due to the fact that they reside in the same web context and in many cases, may refer to one another, directly or indirectly [4,8].
18
Figure 2.1. JSP model architecture. As you can see, the main difference between the two approaches is that the Model 2 architecture introduces a controller servlet that provides a single point of entry and also encourages more reuse and extensibility than Model 1. With the Model 2 architecture, there is also a clear separation of the business logic, presentation output, and request processing. This separation is often referred to as a Model-View-Controller (MVC) pattern. While the
19 Model 2 architecture might seem overly complicated, it can actually simplify an application greatly. Web applications built using the Model 2 approach are generally easier to maintain and can be more extensible than comparable applications built around the Model 1 architecture. The Model Component: Responsible for the business domain state knowledge. The View Component: Responsible for a presentation view of the business domain. The Controller Component: Responsible for controlling flow and state of the user input normally with the MVC pattern, theres a form of event notification that takes place to notify the view when some portion of the model changes. However, since a browser in a typical web application has a stateless connection, the notification from the model to the view cant easily occur. Of course, an application could perform some type of push action to push data changes all the way to a client; but this doesnt and probably shouldnt happen in most web applications. A user can close at a browser anytime and there isnt warning or notification sent to the server. Theres a great deal of overhead necessary to management remote clients from the server side. This type of behavior is overkill for typical B2C and B2B web applications.
20 session data for a user or even store data within the browser on behalf of the user. Some applications may require the need for client-side JavaScript. This does not interface or infringe upon the MVC concept.
2.2.8.6 FRAMEWORK
I have been throwing the word framework around in this chapter without having really defined what exactly it is or how it adds value in software development. In its simplest form, a framework is a set of classes and interfaces that cooperate to solve a specific type of software problem. A framework has the following characteristics: A framework is made up of multiple classes or components, each of which may Provide an abstraction of some particular concept. The framework defines how these abstractions work together to solve a problem. The framework components are reusable. A good framework should provide generic behavior that can be utilized across many different types of applications. There are many interpretations of what constitutes a
21 framework. Some might consider the classes and interfaces provided by the Java language a framework, but its really a library.
22
23 applications. One applications business objects are anothers value objects. Its important to keep the business objects separate from the presentation, so that the application is not tightly coupled to one type of presentation.
24 the Struts framework and XSLT and beans serialized from the value objects to render the views. Many developers feel that JSP has the following problems: Developers are free to embed application logic into the JSP pages. This can lead to an application that is difficult to maintain. JSP syntax is not currently XML compliant, which may cause the XML or HTML that gets generated, not to be well formed. Developers must learn the JSP syntax and how to program custom tags. Developing a processing pipeline where each node in the pipeline may modify the data or layout is not possible with JSP pages. This makes it difficult to separate layout and style.
A recompile of the JSP page is necessary for each change made to the page.
25 the popularity and flexibility of the self-describing nature of XML, both of these configuration files are based on XML. The web application deployment descriptor web.xml is described fully in the Java Servlet specification. This configuration file is necessary for all web applications, not just those built with the Struts framework. There is however, Struts specific deployment information that must be configured within it when building web applications using Struts.
26
CHAPTER 3 METHOD
The ActionForm class provided by the Struts framework is abstract. You need to create subclasses of it to capture your application specific form data. Within your subclass, you should define a property for each field that you wish to capture from the HTML form. The ActionForm is populated from request parameters, not request attributes. If you are forwarding from one action to another, you cant add a request attribute and expect that the ActionForm will be populated from it. Request parameters and request attributes are two separate resources.
27 set to false, the ActionForm will still be populated from the request if an ActionForm is configured for the action. The validate() method in the base ActionForm class simply returns null. If you want to perform validation on the data that is submitted with the request, youll need to override the validate() method in your ActionForm subclasses. The validate() method may return an ActionErrors object, depending on whether or not any validation errors were detected. You also can return null if there are no errors; the framework will check for both null and an empty ActionErrors object. This saves you from having to create an instance of ActionErrors when there are no errors.
28 instance for each new request. Since a new instance is created, theres not much need to reset() the values back to any default state. ActionForms that are configured with session scope are different however. This is the time that the reset() method comes in handy.
29 the application. Each problem discovered is represented by an instance of org.apache.struts.action.ActionError. An ActionErrors object has request scope. Once an instance is created and populated by the validate() method, it is stored into the request. Later, the JSP page can retrieve the object from the request and use the ActionError objects contained within it to display errors messages to the user. The validate() method in this fragment checks to make sure that the email and password fields have been set with values other than an empty string. If not, ActionError objects are added to the ActionErrors instance. The ActionError class contains several useful constructors. Several are listed here: public ActionError(String key); public ActionError(String key, Object value0); public ActionError(String key, Object value0, Object value1); public ActionError(String key, Object[] values); The key argument is a String value that corresponds to a key from one of the applications resource bundles. The custom tag ErrorsTag uses this value to lookup the message to display to the user. The remaining arguments are used as parametric replacement values for the message. For example, if you had a bundle message defined like this: global.error.login.requiredfield=The {0} field is required for login then we could create an instance of an ActionError like this: ActionError error = new ActionError("global.error.login.requiredfield", Email ); The message displayed to the user after substituting in the Email string would be: The Email field is required for login When adding instances of the ActionError class to the ActionErrors object, the first argument in the add() method is a property that can be used to retrieve a specific ActionError instance. If all of your ActionError instances can be treated the same and you have no need to retrieve them individually, you can use the constant ActionErrors.GLOBAL_ERROR similar to this: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("security.error.password.required")); Using the ActionForm class has many advantages over performing the functionality yourself in the Action class or some set of helper utility classes. Since the behavior that the ActionForm class provides is needed in nearly every web application, as well as many times
30 in the same application, using the framework to perform the work can really reduce the development time and your frustration level. Having stated the benefits of using ActionForms, there are a few very important downsides to using them. The first and foremost problem with using ActionForms is the sheer number of classes that it can add to a project. Even if you share ActionForm definitions across many pages, the additional classes make it more difficult to manage a project and provide maintenance. This is why some developers might create a single ActionForm and implement the properties for all of the HTML forms within these. The problem with this of course, is that combining the fields into this one class makes it a point of contention on a project that has more than just a few developers. Another major liability is the requirement to define the properties in the ActionForm that need to be captured from the HTML form. If a property is added or removed from the HTML form, the ActionForm class may need to be modified and recompiled. For these reasons, a new type of ActionForm was added to the framework, which is dynamic in nature and allows you to avoid having to create concrete ActionForm classes for your application. The dynamic ActionForm is implemented by the base class org.apache.struts.action.DynaActionForm, which extends the ActionForm class. The properties that the ActionForm defines: The validate() method. The reset() method. The properties for a DynaActionForm are configured in the Struts configuration file, which youll see how to do in the next section. The reset() method is called at exactly the same time during request processing as it is for a standard ActionForm. The one difference is that you have a little less control over what you do during the method. However, you can always subclass the DynaActionForm to override the reset behavior. The validation of the presentation data is a little more complicated, because well need to wait until we talk about the Struts validate components before talking about how validation occurs in a dynamic form. To use the DynaActionForm in your Struts application, the first step is to add a formbean element to the configuration file. There are two very important differences between a form-bean element for a regular ActionForm and one that is dynamic. First, a form-bean element for a dynamic ActionForm is required to have an attribute called dynamic, which
31 must have a value of true. This is necessary for the framework to understand that it should handle this ActionForm differently. The second difference is that you must include one or more form-property elements in order for the dynamic form to have properties. The DynaActionForm uses a java.util.Map internally to store key/value pairs. The form-property elements are loaded into the Map and become the properties that get populated by the framework. The declarative properties are what make the ActionForm dynamic. At runtime, the framework creates an instance of the DynaActionForm class and makes it possible to set and get the configured property values. To add new properties, you only need to modify the configuration file. No source code needs to be changed. The power and flexibility that this provides for you is immense. The form-beam element also allows you to specify the initial value for each property. The framework will set the property to that value when the application is started. The initial value is also used when the reset() method is called to reset the values back to their original state. If you dont include the initial attribute, then properties will be assigned default values based on the Java programming language; numbers to zero (0) and properties of type Object will be assigned a null value by the framework. Since the DynaActionForm is used for every dynamic ActionForm and you dont provide subclasses of ActionForm, theres no way to override the validate() method. Fortunately, the framework comes to your aid again with a feature called the Struts Validate. The Struts Validator was created by David Winterfeldt and is now in the main Struts distribution. The validator is a framework that was intended to work with Struts from the beginning. It supports basic validation rules like checking for required fields, email, date and time fields, and many others.
32
33
34
3.2.1 Environment
JBoss AS 4.0 is a J2EE 1.4 application server, with embedded Tomcat 5.5. Any JVM between 1.4 and 1.5 is supported. JBoss can run on numerous operating systems including Windows, Mac OS X, many POSIX platforms, and others, as long as a suitable JVM is present. (See Appendix for code).
35 Process: People, procedures, or devices that use or produce (Transform) Data. The physical component is not identified (see Figure 3.2).
Figure 3.2. Process. Source: External sources or destination of data, which may be People, programs, organizations or other entities (see Figure 3.3).
Figure 3.3. Source of data. Data Store: Here data are stored or referenced by a process in the System (see Figure 3.4).
36
Figure 3.5. Data flow diagram which illustrates entire flow in the process. In the Login Screen the entered username and password will be supplied to the authentication server and if the login credentials are valid the user will be directed to the home screen and if they are invalid the user will be taken back to the login screen (see Figure 3.6). After logging in Admin will be redirected to the User Interface which displays all the available admin tasks that are to be performed. These tasks include Creating/Modifying Categories, Creating/Modifying Items and Bidding Information (see Figure 3.7). From the UI Interface Admin adds a new Category which will be stored in the database upon successful creation (see Figure 3.8).
37
38 View Categories will fetch the categories information from the database and displays on the user interface (see Figure 3.9).
Figure 3.9. Level 3 data flow diagram for Admin. In the Categories form category name can be entered and it will be stored in the database (see Figure 3.10).
Figure 3.10. Level 4 data flow diagram for Admin. For Seller the first step is registration and upon successful login the seller will be taken to the UI displaying the set of operations. The operations include View Items, View Categories, View Bidding Information and sale at higher price (see Figure 3.11).
Figure 3.11. Level 1 data flow diagram for seller. From the User Interface clicking the items will fetch the items from the database and will be displayed to the seller (see Figure 3.12).
39
Figure 3.12. Level 2 data flow diagram for Seller. For buyer the first step is registration and upon successful login the UI is displayed with a set of operations. Operations include View Items, View Categories, View Biding Information and buying all possible items (see Figure 3.13).
Figure 3.13. Level 1 data flow diagram for Buyer. Items will be fetched from the database and displayed on the User Interface (see Figure 3.14).
Figure 3.14. Level 2 data flow diagram. Figure 3.15 shows the E-R diagram.
40
QUESTIONBASE CATEGORYMASTER
CATEGORYNAME CATEGORYABBR CATEGORYDESC QUESTIONID QUESTIONDETAIL
ITEMMASTER
ITEMNAME CATEGORYNAME (FK) ITEMDESC SUMMARY ST ART PRICE INCRPRICE ST DAT E ENDDAT E LOGINNAME (FK) BIDCOUNT
LOGINPROFILE
LOGINID (FK) BIRTHDATE HNO STREET CIT Y STATE COUNTRY PINCODE CONTACT NO EMAIL LOCALE PROFILEMODIFIEDDAT E
LOGINDETAILS
LOGINNAME PASSWORD FIRSTNAME LASTNAME LOGINTYPE LOGINST AT US REGDATE SQUEST IONID SANSWER FIRSTLOGIN PASSMODIFIEDDATE
LOGINAUDIT
LOGINID (FK) LOGINDATE LOGINDESC
BIDDINGINFORMATION
BIDDERID LOGINNAME (FK) BAMOUNT IT EMNAME (FK) BIDDERDATE STATUS
Figure 3.15. Entity- Relationship flow which explains the relationship in data.
41
BidderDAO +register(aform: BidderForm): boolean +viewBiddingInformation(loginname: String): CoreList +updateStatus(itemname: String): boolean +viewBiddings(loginname: String): CoreList +viewAllBiddings(): CoreList +viewAllBiddingsInformation(itemname: String): CoreList +updatStatusDetails(itemname: String): boolean
SellItemDAO +register(amodel: ItemModel): boolean +viewItems(loginname: String): CoreList +viewItembyOne(itemname: String): CoreList +updateItems(amodel: ItemModel): boolean +deleteItems(username: String): boolean +viewItembyDetails(itemname: String, categoryname: String): ItemModel +viewItemsByDetails(loginname: String): CoreList +auctionItemDetails(loginname: String): CoreList +auctionItemEndDay(loginname: String): CoreList +viewAllItems(): CoreList
CategoryDAO +register(amodel: CategoryModel): boolean +viewCategorys(): CoreList +viewCategorys(categoryname: String): CategoryModel +update(amodel: CategoryModel): boolean +delete(categoryname: String): boolean
AbstractDataAccessObject ~con: Connection ~props: Properties +getProperties(): Properties +setProperties(props: Properties) +getConnection(): Connection +getSequenceID(tableName: String, pkid: String): int
SecurityDAO ~con: Connection -desc: String -flag: boolean <<create>>+SecurityDAO() +checkPassword(regbean: Profile): boolean +checkFirstLogin(loginname: String): int +loginCheck(loginid: String, password: String): String +loginaudit(loginid: String, desc: String) +changePassword(regbean: Profile): boolean +changeQuestion(regbean: Profile): boolean +recoverPasswordByExistQuestion(regbean: Profile): String +recoverPasswordByOWNQuestion(regbean: Profile): String ProfileDAO +con: Connection -flag: boolean <<create>>+ProfileDAO() +registration(regbean: Profile): boolean +getProfile(loginname: String): Profile +modifyProfile(regbean: Profile): boolean +changeAccountStatus(loginid: String, status: int): boolean +getProfile(): CoreList
42
43
System
Admin
Customer
View Customers
ViewProfile
44
Registration
Login
Buy
Items Sell
Customer ViewProfile
ActionItems
1 : login()
2 : validate()
3 : AdminHome() 4 : viewCustomers()
Figure 3.20. Login ->Validate Login->View Customers->View Bid Items->view Auction items today and end day.
45 From the admin home the following are the tasks that admin can perform (see Figure 3.21):
View Customers: Admin can view information of all the registered customers from this page. View Bid Items: Admin can view all the items that are up for bidding through this page. View Auction Items Today: Admin can view all the items that are up for auction for that particular day. View Auction Items End Day: Admin can view all the auction items whose auction date ends that day.
Login BuyItem SellItem Auction Items Today Auction Item EndToday
Customer
1 : enterLogin()
2 : validate()
Figure 3.21. Buyer/seller (Customer) Sequence Diagram. Login ->Validate Login>Bid Item->Sell Item->view Auction items today and end day. After providing login details for customer login the details will be validated and after successful validation it will be redirected to the customer home page. From the customer home the following are the tasks that customer can perform:
Bid Item: customer can bid for the items available from this page. Sell Item: Customer can sell the items to aany of the registered customer from this page. View Auction Items Today: Admin can view all the items that are up for auction for that particular day. View Auction Items End Day: Admin can view all the auction items whose auction date ends that day.
46
Admin
Figure 3.22. Admin collaboration diagram. Admin after validating login information will be taken to the admin home page and from the home page he can view the customers info, bid items, auction items today and end day (see Figure 3.23).
47 Customer after login validation will be taken to the customer home page and from the home page he can bid for items, sell items, view auction items today and end day.
48
Adm in
Login
Login
Validate
ValidLogin
Login
validate
ValidLogin
Login
validate
validLogin
1: Login
9: validLogin
3: ValidLogin 7: Login
Login
Admin
Login Fail
Enter Username,password
Success
Home
Item
Categories
BiddingInfo
LogOut
Add Items
View Items
Add Categories
View Categories
Add BiddingInfo
View BiddingInfo
OwnerOf Article
Login Fail
Success
Hom e
Item
Categories
BiddingInfo
LogOut
View Items
View Categories
View BiddingInfo
Update Item s
delete Items
50
Registered Bidder
Login Fail
Success
Hom e
Item
Categories
BiddingInfo
LogOut
View Item s
View Categories
View BiddingInfo
51
52
53 error that may or may not actually manifest as a failure. A fault can also be described as an error in the correctness of the semantic of a computer program. A fault will become a failure if the exact computation conditions are met, one of them being that the faulty portion of computer software executes on the CPU. A fault can also turn into a failure when the software is ported to a different hardware platform or a different compiler, or when the software gets extended. Software testing is the technical investigation of the product under test to provide stakeholders with quality related information. Software testing may be viewed as a sub-field of Software Quality Assurance but typically exists independently (and there may be no SQA areas in some companies). In SQA, software process specialists and auditors take a broader view on software and its development. They examine and change the software engineering process itself to reduce the amount of faults that end up in the code or deliver faster. Regardless of the methods used or level of formality involved the desired result of testing is a level of confidence in the software so that the organization is confident that the software has an acceptable defect rate. What constitutes an acceptable defect rate depends on the nature of the software. An arcade video game designed to simulate flying an airplane would presumably have a much higher tolerance for defects than software used to control an actual airliner. A problem with software testing is that the number of defects in a software product can be very large, and the number of configurations of the product larger still. Bugs that occur infrequently are difficult to find in testing. A rule of thumb is that a system that is expected to function without faults for a certain length of time must have already been tested for at least that length of time. This has severe consequences for projects to write long-lived reliable software. A common practice of software testing is that it is performed by an independent group of testers after the functionality is developed but before it is shipped to the customer. This practice often results in the testing phase being used as project buffer to compensate for project delays. Another practice is to start software testing at the same moment the project starts and it is a continuous process until the project finishes. Another common practice is for test suites to be developed during technical support escalation procedures. Such tests are then maintained in regression testing suites to ensure
54 that future updates to the software don't repeat any of the known mistakes (see Table 4.1). It is commonly believed that the earlier a defect is found the cheaper it is to fix it. Table 4.1. Performance Table Time Detected Time Introduced Requirements Architecture Construction Requirements 1 Architecture 3 1 Construction 5-10 10 1 System Test 10 15 10 PostRelease 10-100 25-100 10-25
In counterpoint, some emerging software disciplines such as extreme programming and the agile software development movement, adhere to a "test-driven software development" model. In this process unit tests are written first, by the programmers (often with pair programming in the extreme programming methodology). Of course these tests fail initially; as they are expected to. Then as code is written it passes incrementally larger portions of the test suites. The test suites are continuously updated as new failure conditions and corner cases are discovered, and they are integrated with any regression tests that are developed. Unit tests are maintained along with the rest of the software source code and generally integrated into the build process (with inherently interactive tests being relegated to a partially manual build acceptance process). The software, tools, samples of data input and output, and configurations are all referred to collectively as a test harness.
4.2 HISTORY
The separation of debugging from testing was initially introduced by Glen ford J. Myers in his 1978 book the "Art of Software Testing". Although his attention was on breakage testing it illustrated the desire of the software engineering community to separate fundamental development activities, such as debugging, from that of verification. Drs. Dave Gelperin and William C. Hetzel classified in 1988 the phases and goals in software testing as
55 follows: until 1956 it was the debugging oriented period, where testing was often associated to debugging: there was no clear difference between testing and debugging. From 1957-1978 there was the demonstration oriented period where debugging and testing was distinguished now - in this period it was shown, that software satisfies the requirements. The time between 1979-1982 is announced as the destruction oriented period, where the goal was to find errors. 1983-1987 is classified as the evaluation oriented period: intention here is that during the software lifecycle a product evaluation is provided and measuring quality. From 1988 on it was seen as prevention oriented period where tests were to demonstrate that software satisfies its specification, to detect faults and to prevent faults. Dr. Gelperin chaired the IEEE 829-1988 (Test Documentation Standard) with Dr. Hetzel writing the book "The Complete Guide of Software Testing". Both works were pivotal in to today's testing culture and remain a consistent source of reference. Dr. Gelperin and Jerry E. Durant also went on to develop High Impact Inspection Technology that builds upon traditional Inspections but utilizes a test driven additive. Online auction enables users to participate in user friendly auction of all the utilities they wish to buy. Users can bid for their favorite items with ease. This application is developed so as to help the users to bid for their favorite items by going through all the items available for auction. There are 2 main modules available in the application: Admin Module. User Module. Admin Module: Admin module does all the tasks that enable the user to bid for an item effortlessly. The following are the tasks that the admin will take care of: Admin will create and update the categories. Under Categories we can find different items that are up for the auction. Admin will take care of all the information regarding the items under each Category. Admin will be responsible for all the actions done by the users. Admin can block the users and can change the privileges of the selected user. Admin can delete the categories and can delete the items that are up for the auction.
56 User Module: User module is the place where users can register themselves so that they can bid for the items available and can add items for auction. The following are the features available for the user: User can add items to the categories available so that the items can be available for auction. User can view all the items that are up for the auction and can bid for any item available. User can remove the items owned by him from the auction and can fix an end date for the auction. Online auction is an effort towards making the auction process transparent and easy to users. Users can bid for the items available and can add the items for the auction.
57
58 Reduced errors due to human intervention. User friendly screens to enter the data. Portable and flexible for further enhancement. Web enabled. Fast finding of information requested.
59
REFERENCES
[1] [2] J. BLOCH, Effective JavaProgramming Language Guide, Addison-Wesley, Boston, Massachusetts, 2001. P. A. BONATTI, C. DUMA, D. OLMEDILLA, AND N. SHAHMEHRI, An integration of reputation-based and policy-based trust management, in Proceedings of the Semantic Web Policy Workshop, Galway, Ireland, 2005. CARNEGIE MELLON UNIVERSITY, Online auction fraud: Data mining software fingers both perpetrators and accomplices. Science Daily, http://www.sciencedaily.com/ releases/2006/12/061205143326.htm, accessed May 2011, Dec. 5, 2006. E. FREEMAN AND E. FREEMAN, Head First HTML with CSS & XHTML, OReily Media, Sebastopol, California, 2005. GAMPASOFT, Quality assurance, Gampasoft.com, http://www.gampasoft.com/ quality.html, accessed May 2011, n.d. C. S. HORTSMANN AND G. CORNEL, Core Java 2, Volume I Fundamentals, Prentice Hall, Upper Saddle River, New Jersey, 2004. C. S. HORTSMANN AND G. CORNELL, Core Java Volume IIAdvanced Features, Prentice Hall, Upper Saddle River, New Jersey, 2008. F. MARCHIONI, JBoss AS 5 Development, Packt Publishing, Birmingham, England, 2009. H. MARTY, More Servlets and JavaServer Pages, Pearson Education, Upper Saddle River, New Jersey, 2001.
[3]
[10] N. RICHARDS AND S. GRIFFITH, JBossA Developers Notebook, OReilly Media, Sebastopol, California, 2005. [11] D. THAU, The Book of JavaScript 2nd Edition: A Practical Guide to Interactive Web Pages, No Starch Press, San Francisco, California, 2006. [12] J. TREVATHAN AND W. READ, Detecting collusive shill bidding, in Proceedings of the Fourth International Conference on Information Technology: New Generations, Las Vegas, Nevada, 2007. [13] W. WANG, H. ZOLTN, AND A. B. WHINSTON, Shill bidding in multi-round online auctions, in Proceedings of the 35th Hawaii International Conference on System Sciences, Big Island, Hawaii, 2002.
60
APPENDIX CODE
61 JSP <%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<HTML> <HEAD> <script language="JavaScript" src="scripts/gen_validatorv31.js" type="text/javascript"></script> <script language="JavaScript" type="text/javascript" src="scripts/ts_picker.js"></script> <script language="JavaScript1.1" src="scripts/pass.js">
</script> <script type="text/javascript" src="scripts/image.js"> </script> <script type="text/javascript" src="scripts/general.js"> </script> <script type="text/javascript" src="scripts/adi.js"> </script> <script type="text/javascript" src="scripts/form_validation.js"> </script>
62 <!-.style1 { font-size: 16px; font-weight: bold; } --> </style> </HEAD> <BODY bgColor="#a3d881" leftMargin="0" topMargin="0" MARGINHEIGHT="0" MARGINWIDTH="0"> <!-- ImageReady Slices (Untitled-1) --> <DIV id="Layer1" style="Z-INDEX: 1; LEFT: 410px; WIDTH: 328px; POSITION: absolute; TOP: 65px; HEIGHT: 35px">
</DIV> <!-- End ImageReady Slices --> <TABLE cellSpacing="0" cellPadding="0" width="781" border="0"> <TBODY><BR> <TD></TD>
</TBODY></TABLE> <!-- End ImageReady Slices --><!-- End ImageReady Slices -->
<TABLE height="632" width="98%" border="0"> <TBODY> <TR><td></td></TR> <TD vAlign="top" borderColor="#009900" width="25%" height="432">
63 <TABLE height="207" width="99%" border="0"> <TBODY> <TR> <TD vAlign="top" background="home_files/eimage2.GIF" height="114"> <P align="center"><FONT color="#ffcc00"> <STRONG><FONT face="Georgia, Times New Roman, Times, serif" color="#ff0000" size="4"><EM>Buy Now</EM></FONT></STRONG></FONT></P> <P align="center"><EM><FONT face="Georgia, Times New Roman, Times, serif" color="#ff0000" size="4"><STRONG>Old Audio & Video C.D.'s</STRONG></FONT></EM></P> </TD> </TR> <TR> <TD vAlign="top" height="87"><STRONG>Post Items for Auction</STRONG> Once you register, you can post items for auction any time you want.</TD> </TR> </TBODY> </TABLE>
<P><IMG height="133" src="home_files/OFFER1.GIF" width="204"></P> <P align="center"><FONT face="Georgia, Times New Roman, Times, serif" color="#333399"><A href="./help.jsp"> How To
64 <TD vAlign="top" width="90%" bgcolor="#C23D38"><jsp:include page="Adminoptions.jsp"/> <H1 align="justify"><FONT size="2"><br/><br/> </FONT> <center> <span class="style1">Category Master Form</span> </center> <FONT size="2"><br/> <br/><form action="categoryaction.do" name="register"> <table align="center" bgcolor="#A3D881"> <tr><td><em><strong>Category Name</strong></em></td> <td><input type="text" name="categoryname"/></td></tr> <tr><td><em><strong>Category Abbreviations </strong></em></td> <td><input type="text" name="categoryabbr"/></td></tr> <tr><td><em><strong>Category description </strong></em></td> <td><input type="text" name="categorydesc"/></td></tr> <tr><td></td> <td><input type="submit" name="Send" value="Register"/></td></tr> </table> </form> <script language="JavaScript"
type="text/javascript">
65 //You should create the validator only after the definition of the HTML form var frmvalidator = new Validator("register");
frmvalidator.addValidation("categoryabbr","req","Please enter Category Abbr"); frmvalidator.addValidation("categorydesc","req","Please enter Category Desc"); </script> </FONT> <BR><BR> <BLOCKQUOTE> </H1>
</BLOCKQUOTE>
</TD>
66
<P><IMG height="120" src="home_files/ADD4.GIF" width="160"></P> <P><img height="120" src="home_files/ADD4.GIF" width="160"> </P> </TD>
<TR> <TD vAlign="top" height="194"> <TABLE height="168" width="99%" border="1"> <TBODY> <TD vAlign="top" height="137"> <IMG height="133" src="home_files/AIMAGE2.GIF" width="199"></TD> </TR> <TR> <TD>Just Rs'2000/</TD> </TR> </TBODY></TABLE> </TD> <TR>
<TD vAlign="top"> <TABLE height="168" width="50%" border="1"> <TBODY> <TR> <TD vAlign="top" width="51%" height="137"> <IMG height="133"src="home_files/EIMAGE4.GIF" width="190"></TD>
67 <TD vAlign="top" width="49%"><IMG height="133" src="home_files/TIMAGE1.GIF" width="180"></TD> </TR> <TR> <TD height="23">Just Rs'550/-</TD> <TD>Just Rs'25000/-</TD> </TR> </TBODY></TABLE> </TD>
<TD vAlign="top"> <TABLE height="168" width="86%" border="1"> <TBODY> <TR> <TD vAlign="top" height="137"> <IMG height="133" src="home_files/HIMAGE7.GIF" width="156"></TD> </TR> <TR> <TD height="23">Just Rs'22000/-</TD> </TR> </TBODY></TABLE> </TD> </TR> </TBODY></TABLE> <HR align="left" width="780"> <DIV align="center"><STRONG> |</STRONG> <A href="./NewToday"> New Items</A> <STRONG>|</STRONG> <A href="./EndToday">
public boolean register(CategoryModel amodel) { boolean flag=false; Connection con=null; try{ con=getConnection();
PreparedStatement pst=con.prepareStatement("insert into values(?,?,?)"); pst.setString(1,amodel.getCategoryname()); pst.setString(2,amodel.getCategoryabbr()); pst.setString(3,amodel.getCategorydesc()); int n=pst.executeUpdate(); if(n>0) categorymaster
69 { flag=true; }
}catch (Exception e) { e.printStackTrace(); // TODO: handle exception } return flag; } public CoreList viewCategorys() { CoreList acorelist=new CoreList(); Connection con=null; CategoryModel amodel=null; try{ con=getConnection(); PreparedStatement pst=con.prepareStatement("select * from categorymaster"); ResultSet rs=pst.executeQuery(); while(rs.next()) { amodel=new CategoryModel(); amodel.setCategoryname(rs.getString(1)); amodel.setCategoryabbr(rs.getString(2)); amodel.setCategorydesc(rs.getString(3)); acorelist.add(amodel); }con.close(); }catch (Exception e) { e.printStackTrace(); // TODO: handle exception
70 } return acorelist; } public CategoryModel { CoreList acorelist=new CoreList(); Connection con=null; CategoryModel amodel=null; try{ con=getConnection(); PreparedStatement pst=con.prepareStatement("select * from categorymaster where Categoryname=?"); pst.setString(1,categoryname); ResultSet rs=pst.executeQuery(); while(rs.next()) { amodel=new CategoryModel(); amodel.setCategoryname(rs.getString(1)); amodel.setCategoryabbr(rs.getString(2)); amodel.setCategorydesc(rs.getString(3)); viewCategorys(String categoryname)
}con.close(); }catch (Exception e) { e.printStackTrace(); // TODO: handle exception } return amodel; } public boolean update(CategoryModel amodel) {
PreparedStatement pst=con.prepareStatement("update categorymaster set Categoryabbr=?,Categorydesc=? where Categoryname=?"); pst.setString(1,amodel.getCategoryabbr()); pst.setString(2,amodel.getCategorydesc()); pst.setString(3,amodel.getCategoryname());
}catch (Exception e) { e.printStackTrace(); // TODO: handle exception } return flag; } public boolean delete(String categoryname) { boolean flag=false; Connection con=null; try{ con=getConnection();