JS This is my original learning time to write a note, may not finish, roughly looked at, the new may have some use, posted up.
This note is very old, today to clean up the hard drive out, so the point of view may be wrong.
have time to change again.
when a browser requests a JSP file from the server, the JSP file is first compiled into a servlet by the Web application server and executed, and the resulting result is passed to the browser as an HTML file. As long as the JSP file to add some control, it can easily achieve the dynamic display of data. Later, if there is another request for this JSP file, if the file is not modified, it will not be compiled, but directly execute the compiled servlet. However, these processes on the Web application server require time and resources, which will inevitably increase the load on the Web application server and the corresponding extended response time. In particular, the entire system has just started or a large number of JSP files made changes.
The function of the
JSP is quite powerful, and some people say it can even accomplish almost all the functions. There is no mistake, but when we take into account the reusability of the code and the ease of implementation, I am afraid that all of the functionality through the JSP file is not a good choice. More, we still use JSP file as a response, to dynamically display the data in a state. Another feature of JSP is that it is very much like an HTML file and is made up of a number of tags, so we can also edit it using WYSIWYG editors such as Pagedesinger in WebSphere Studio. Moreover, it is more conducive to collaboration among different developers. JSP files are like a template, waiting for different data to fill, and the implementation of this dynamic mechanism is those embedded HTML tags JSP tags. Based on this idea, the editor of a Web page can first design a rough template (the static part of the page) and then add the dynamic control code to the template by the developer. When it's all done, you can use some kind of debugging tool from JSP to debug.
The debugging of JSP file is divided into two stages, compile stage and run state stage. It should be said that the JSP file in the compile phase of debugging is more difficult, because any grammatical errors will lead to the JSP file compilation does not pass, but there is no information to explain exactly what is wrong. Sometimes it takes a long time for a bracket to be missing. Once the compiler passes, there are ways to solve the problem of the running state. I think the best run-time debugging tool is to count the JSP execution monitor in VisualAge for Java's WebSphere Test environment, which can step through the code snippets in the JSP file, making it easy to locate and modify errors.
compared to Perl, Shell script and other CGI, the servlet has the advantage that it resides only once, can handle multiple HTTP requests, and other CGI programs create a process for each request. As a result, the servlet can save a certain amount of resource consumption.
servlet and JSP face the same problem, that is, it takes time to load. When a Web application is started, the first call to a servlet is often slow, and later calls are much better. This problem is determined by the way the servlet is invoked and the lifecycle in the engine. If a site is highly valued for Web application performance, it may be useful to write a simple program that simulates HTTP requests for all servlet and JSP files to initialize the entire Web application so that it loads all the functionality before it is actually applied.
The
servlet is also a Java program, so it inherits all the features of the Java language. If all the servlet of a Web application has a common function, such as a connection to a back-end database, we can write a generic servlet to accomplish these functions, while the other servlet inherits from the common servlet.
The data Bean, as its name suggests, is dealing with it. More strictly, it is a kind of encapsulation of data. Although there are beans, but unlike JavaBeans, it does not have the JavaBeans event handling. It can be said that the data bean is the shortest part of the entire programming model, because it is a get and set method that operates on these data fields in addition to the data field. The data bean is actually a mapping of the data structure. Generally, if the database schema of a Web application is determined, the number and interface of the data bean are basically determined. The development of the data bean, however, is much simpler. In many Java development environments, a data bean can be generated by wizard, and what the developer needs to do is simply tell wizard how many attributes the data bean has, and what type of each attribute. In fact, if you write the data bean manually, it is not a laborious thing.
on the server side, the last element we want to talk about is DB Object. Its purpose is to construct the SQL statements required for the operation of the database and to get the result set after execution. It is needed because each time we operate on the database differently, such as lookup, there are many situations that can arise because of different query conditions. This requires different SQL statements to be constructed according to the circumstances. Only in this way can our programs achieve higher utilization and reduce the amount of development effort.
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.