Graduation Thesis-Large Web application Development _ Graduation Thesis

Source: Internet
Author: User
Tags file upload network function zip tomcat
Summary
The Java language is the most popular programming language for the development of large Web applications on the Internet, and this article describes the characteristics of Java and JSP technology and how it is used on the Internet, and introduces the important programming methods of these two technologies and the connection between them. and complete an online bookstore system based on this technology.
"keywords" JAVA, JavaBeans, Servlet, JSP, network programming, e-commerce, online bookstore
Abstract
At present Java are the hottest programming language for WEB development, this text described the characteristics of Java a nd JSP Technology and the state of operating on the Internet, It introduced the relationship between them and the important PR Ogramming method is the double technology, and work out a online bookstore system base on this kind of technology.
Keywords:java, JavaBeans, Servlet, JSP, web program, Internet, Bookshop
Directory
1, Java Network functions and programming
1-1 Java language Introduction
The application of 1-2 Java language on the network
Basic--servlet Technology of 1-3 JSP
1-4 JavaBeans Technology
2. Introduction of JSP Technology
2-1 Configuring the JSP Runtime environment under Windows platform
Comparison of 2-2 JSP, ASP and PHP technology
2-3 JSP Syntax Basics
2-3-1 HTML files embedded in the Java language
2-3-2 request, Out & response--interaction with visitors
2-3-3 session--Keep the session state of the visitor
2-3-4 JSP other basic built-in objects
2-4 Several main ways of developing Web application with JSP
2-4-1 Direct use of JSP
2-4-2 JSP + JavaBeans
2-4-3 JSP + JavaBeans + Servlet
Advanced features implemented by 2-5 JSP + JavaBeans
2-5-1 access to the database with JSP
2-5-2 with JSP + JavaBeans implementation file upload
MVC development Model of 2-6 JSP
3, online bookstore system design project needs analysis
3-1 model of the online bookstore system
3-2 Establishment of online bookstore system database
4, the development of the online bookstore system
4-1 Background Management
4-1-1 Admin Login
4-1-2 book category management
4-1-3 Book Product management
4-1-4 Registered Member Management
4-1-5 Book Order Management
4-2 Online Bookstore Interface
4-2-1 Book Search
4-2-2 View book details
4-3 Online Shopping Program
4-3-1 User Registration
The realization of 4-3-2 shopping basket
5, summary
Chapter One the network function and programming of Java
1-1 Java language Introduction
Java is a simple, easy-to-use, fully object-oriented, platform-independent and secure, primarily Internet-oriented development tool. Since its inception in 1995, the rapid development of Java has transformed the entire web world. In the early days, Java more used in the browser, inserted into the Web page (that is, Java applet program), as the most flexible, most powerful web multimedia carrier, but because the Java virtual machine relative to the personal computer, the use of resources, relatively poor security and other shortcomings, Applets are gradually replaced by Up-and-comer Flash, but with the advent of the Java servlet, Java is beginning to emerge in E-commerce, with the latest JSP (Java Server Page) technology launched, Let Java become the preferred development tool for web-based applications, the current Java technology has become a necessary choice for all large-scale e-commerce projects.
The application of 1-2 Java language on the network
Java programs can capture the network nodes of the image, sound, HTML documents and text and other resources, and can handle the resources obtained. For example, a Java program can read the latest data provided by a node at intervals and display it as a chart. In programming, Mr. General becomes an object of a URL type, and then uses the corresponding method in Java to get the resource that the object represents. The following is a description of how Java obtains images from the network.
Java applets can get images directly from nodes on the network and display them, and Java provides the following ways to create images that correspond to other nodes:
GetImage (new URL (String))
There are two ways to use the format:
String url = "Node url";
Image Image;
try {
Image = GetImage (new URL (URL));
}
catch (Exception e) {
System.out.println ("Can ' t Open the URL");
}
Or
URL Imgur=null;
Image Image;
try {
Imgur=new url ("Node url");
}
catch (Malformedurlexception e) {
System.out.println ("Can ' t Open the URL");
}
Image=getimage (Imgur);
The previous format generates a URL object with a new URL (URL) and acts directly as a getimage parameter, which generates a URL object with a new URL (URL), and then to GetImage, the two formats are essentially the same, and the following is a complete instance ( Img.java):
Import java.applet.*;
Import java.net.*;
Import java.awt.*;
public class IMG Extends applet{
Image Image;
public void init () {
String url = "Yun_qi_img/logo1.gif";
try {
Image = GetImage (new URL (URL));
}catch (Exception e) {}
}
public void Paint (Graphics g) {
G.drawimage (image, 0, 0,this);
}
}
Save the program in Img.java, execute Javac img.java, get compiled Img.class, and finally create an HTML document that calls the two Java applets and place them in the same directory as the Img.class, corresponding HTML documents can be as follows ( img.html):
The above is only Java in some aspects of client application, at present, the more extensive application of Java is on the server side, this is the main topic of this article, the following mentioned servlet, JSP and other technologies are Java in the server-side application of the specific form.
Basic--servlet Technology of 1-3 JSP
Java servlet is the basis of JSP technology, JSP itself is precompiled into a servlet, and then run, and the development of large-scale Web applications need Java servlet and JSP to complete, the servlet name probably originated from the applet, Now the domestic translation of a lot of, this article in order to avoid misunderstanding, this article directly using the servlet name without doing any translation, readers, if willing, can be called "Small service Program." The servlet actually works the same way as traditional CGI programs and web application development tools such as ISAPI and NSAPI, and after using the Java servlet, users no longer have to use inefficient CGI It is also not necessary to dynamically generate Web pages using APIs that can only be run on a fixed Web server platform. Many Web servers support servlet, even Web servers that do not directly support the servlet can support the servlet through additional application servers and modules. Thanks to the cross-platform nature of Java, the servlet is platform-independent, in fact, as long as the Java servlet Specification is compliant, the servlet is completely platform-independent and Web-server independent. The Java servlet is highly efficient because the internal Java Servlet provides services in a threaded fashion and does not have to start a process for each request, and it can serve multiple requests at the same time using multithreaded mechanisms. But the Java servlet is not without drawbacks, and the traditional CGI, ISAPI, Nsapi Way, the Java servlet is the use of output HTML statements to implement dynamic Web pages, if the Java servlet to develop the entire Web site, The process of integrating dynamic and static pages is a nightmare. That's why Sun also launches the Java Server pages.
1-4 JavaBeans Technology
What is JavaBeans? JavaBeans is Java's reusable component technology. ASP extends complex functions through COM, such as file uploads, sending emails, and separating business processing or complex computing into independent reusable modules. JSP achieves the same function expansion through JavaBeans. JSP provides complete support for integrating JavaBeans components in Web applications. This support not only shortens development time (can directly leverage tested and trusted existing components, avoids duplication of development), but also provides more scalability for JSP applications. The JavaBeans component can be used to perform complex computational tasks, or to interact with the database and to extract data. In the actual JSP development process, the reader will find that the traditional ASP or PHP page, compared to the JSP page will be very concise, because JavaBeans development is simple, but also can take advantage of the powerful Java language capabilities, Many dynamic page processing processes are actually encapsulated in the JavaBeans.
Chapter II Introduction of JSP technology
2-1 Configuring the JSP Runtime environment under Windows platform
In order for the system to run JSP and related programs properly, you must first configure a Web server that can use JSP. The most common Web servers that use servlet technology are Tomcat servers, and if the Tomcat configuration is too complicated for testing purposes only, the resin server is recommended, resin is supposedly the fastest servlet platform to run, However, limited to a single site, some traditional gateway support is not very good, so for the commercial web site is not the best choice, but if only to test the servlet, this resin installation is a bit of a fool.
Resin compared to the new version is 3.x, but the actual use of the 2.x version of more, resin can be downloaded to the official site: http://www.caucho.com/download/This article uses the 2.1.13 version, file location: http:// Www.caucho.com/download/resin-2.1.13.zip
If you have installed the JDK on your computer, unzip the downloaded resin package directly to D: The directory of the D:\resin-2.1.13 as the server after decompression, the source program Jspweb folder is also placed in D: The directory, that is D:\jspweb for the site root directory, open D : \resin-2.1.13\conf\ resin.conf (is an XML form of configuration file), locate doc here instead D:\jspweb, then run D:\resin-2.1.13\bin\httpd.exe, enter HTTP in the browser ://localhost:8080/j1.jsp, see "I'm jsp!. "The word of it, your servlet server so configured successfully, in order to be able to compile the servlet class, also need to do is: To add D:\resin-2.1.13\lib to Windows Classpath environment variables.
Comparison of 2-2 JSP, ASP and PHP technology
JSP and ASP, PHP technology are currently online most popular in the server-side script technology, JSP can use JavaBeans technology encapsulation, to achieve the purpose of business logic, ASP corresponds to the COM components, so both can be used to develop business logic, PHP is more like a pure script, This is best suited to normal web site development and not to be used as a business logic with the name "Person Home Page".
JSP compared with ASP, JSP has Cross-platform, secure, powerful scalability characteristics, and hard to pick some problems, JSP relative to other scripts more difficult to master, because proficient JSP must be proficient in the Java language, for small and medium projects, we have to consider the development of personnel, development speed, development costs and other issues, In this respect ASP and PHP will be more likely to win than JSP.
It is worth mentioning that The latest version of the ASP asp.net is completely different from the original ASP properties, like JSP, it is a kind of compiler script, itself completely with the powerful NET framework, the perfect support for all kinds of XML applications, and the old ASP, but no matter asp or asp.net, it can not get rid of win Dows platform itself, which is a fatal disadvantage of ASP.
2-3 JSP Syntax Basics
2-3-1 HTML files embedded in the Java language
Save the following page as: j1.jsp
This becomes the simplest JSP page, where
is to declare the output of the file type is text/html, character encoding is gb2312, the content in the JSP is the JSP compile some of the options or send the client the header information of the JSP instructions, the contents of the Java language, if necessary, change the appropriate settings, You can also use JavaScript as a script, but very few people do this in practical applications.
2-3-2 request, Out & response--interaction with visitors
Receiving the client's request and returning the information to the client is the most common thing for dynamic Web pages, in JSP, mainly through the request, response, out of the three major objects to achieve these functions.
The purpose of the request object is to receive information from the user through a URL or through a table one-way server to send request information and related to the user's computer.
The response object is used to return a response from the Web page to the client.
Out is used to transmit the output of a response, that is, to return information to the client.
Make a slight change to the above example:
Save as j2.jsp input on the browser: "Http://localhost:8080/j1.jps?msg= I am JSP" look at the effect, this and j1.jsp the result is the same? But it outputs the information returned by the client, which is completely different from the former.
2-3-3 session--Keep the session state of the visitor
Session state maintenance is a problem that WEB application developers must face. There are several ways to solve this problem, such as using Cookies, hidden form input fields, or attaching state information directly to a URL. The Java Servlet provides a session object that is continuously valid between multiple requests, allowing the user to store and extract session state information, which is also built into the JSP.
The most basic usage of the session is:
Create a session session.putvalue ("name", "value");
Gets the value of a session session.getvalue ("name");
2-3-4 JSP other basic built-in objects
JSP has nine large built-in objects, in addition to the above four, but also includes:
The properties of the PageContext Web page are managed here
What the application servlet is doing
Config servlet frame part
Page JSP pages themselves
Exception for error pages, not captured exceptions
These basic built-in objects are an important factor in forming JSP pages.
2-4 Several main ways of developing Web application with JSP
This article is a charge paper, the word number is greater than 8000, including source code, the price is: 300 yuan, please contact qq:2500875 to obtain the full text.
Summarize
This article describes some basic knowledge of java/jsp in Web application, and through the online bookstore program on the application of JSP deepened, from this article can see the combination of JSP and JavaBeans model, E-commerce application is very flexible, but to really master them is not an easy thing , in the actual application of web development, there are a lot of security issues to consider, in addition, E-commerce Web site in the use of online payment platform interface is generally in the form of XML server communication, this article is not involved in these aspects.
Annex: Jspweb.zip, including all the source programs mentioned in this article, as well as the online bookstore system.
Resources:
(1) JSP programming Skills/Qinghong Computer Studio authoring. Beijing: Machinery Industry Press, 2001.1
(2) Proficient in the JBuilder 3 environment of Java Programming/Creative room authoring. Beijing: People's post and telecommunications press., 2001.1
(3) deep into Java Servlet Network programming. Tsinghua University Press

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.