Discover java servlet jsp cookbook, include the articles, news, trends, analysis and practical advice about java servlet jsp cookbook on alibabacloud.com
The difference between servlet and JSP* There are no built-in objects in the servlet, the built-in objects in the original JSP must pass through the HttpServletRequest object, orHttpServletResponse object generation.* For static HTML tags, the servlet must use the page outpu
the "+" operator with StringBuffer.
Avoid using the System.out.println () method: Because System.out.println () is a synchronous invocation, when it is invoked, disk I/O operations must wait for it to complete, so we try to avoid invoking it. But when we debug the program it is an essential convenience tool, in order to solve this contradiction, I suggest you better use the log4j tool (http://Jakarta.apache.org;), it can be easily debugged, and will not produce System.out.println ( ) such a me
/CallThere is a request to reach the container, and the container invokes the Servlet object's service () method.The service () method of HttpServlet calls the Doget () or Dopost () method according to the requested method. However, these two do methods, by default, throw an exception and require subclasses to override.Phase IV: destructionThe container removes the Servlet objects that are no longer needed,
What are servlet and JSP
There are two main technologies used to develop Web applications in Java, namely, Servlet and JSP. A servlet is a Java program that executes on the server side
layer, and the Servlet is used as the control layer, because too much code in the JSP is not conducive to maintenance, This is left to the servlet, and a lot of repeating code is written in JavaBean.
"8" The difference between the two is that the development interface is JSP directly can be written.
For example, w
called when the Web container shuts down or detects that a servlet is being removed from the container, so that the instance frees up the resources it consumes.4: UninstallWhen a servlet finishes calling the Destroy () method, the secondary instance waits to be reclaimed by the garbage collector, and the init () method initialization is called again if the servlet
the browser become '? '?How are the Chinese characters in the Servlet pages that are seen in the browser garbled?How do Chinese characters in the JAVA application interface become squares?Jsp/servlet Page Cannot display GBK Kanji.Jsp/servlet cannot receive the Chinese chara
1. What are the built-in JSP objects?
A: JSP has nine built-in objects:
Request: User-side request, which contains parameters from the get/POST request
Response: response from the webpage to the client
Pagecontext: Manage webpage attributes
Session: the session period related to the request.
Application: servlet content being executed
Out: used to send response o
What is a Web container
Web container (Container) is the only HTTP server recognized by servlet/jsp
At a specific level, the container is basically a program written in Java, running on the JVM, different types of containers will be responsible for different work, if the servlet/
:/test and compile it with the following command:C:/Test> javac TestBean. javaThen a compiled bean file TestBean. class will be generated in c:/Test.3. Cut the TestBean. class file to % CATALINA_HOME %/webapps/myapp/WEB-INF/classes/test,4. Create a New TestBean. jsp file with the following content:TestBean testBean = new TestBean ("This is a test java bean .");%>Java
function. This article describes how to use JSP/servlet to build a three-tier management information system.
2. Three-tier architecture of the system
System's three-tier architecture 1.
Figure 1 Java-based Web application architecture
the entire management information system adopts the Browser/Web/database three-tier architecture. The Web server accept
/CallThere is a request to reach the container, and the container invokes the Servlet object's service () method.The service () method of HttpServlet calls the Doget () or Dopost () method according to the requested method. However, these two do methods, by default, throw an exception and require subclasses to override.Phase IV: destructionThe container removes the Servlet objects that are no longer needed,
Js|servlet| Program | optimization
Is your Java application running very slowly? Can they afford to keep up with the rising traffic? This article describes the development of high-performance, highly resilient JSP pages and the performance optimization of the servlet technology. The idea is to build as fast as possible
Is your Java application running very slowly? Can they afford to keep up with the rising traffic? This article describes the development of high-performance, highly resilient JSP pages and the performance optimization of the servlet technology. The idea is to build as fast as possible and adapt to a growing number of users and their requests. In this article, I'm
useful in the development stage. However, it is very expensive in the running stage; servlet/JSP causes poor performance due to unnecessary loading and increasing the load on the class loader. Similarly, this will cause a strange conflict between the classes loaded by a certain type of loader and the classes loaded by the current class loader. Therefore, in the runtime environment, disable the automatic lo
technologies:JSP vs Active Server Pages (ASP)Microsoft ASP is a technology similar to JSP. JSP has two advantages over ASP. First, the dynamic part is written in Java, rather than VB Script or other Microsoft languages, which is more powerful and easy to use. Second, JSP applications can be transplanted to other opera
Js|servlet| Performance
Overview
In this article, Rahul Chaudhary describes the use of the Performance tuning technology (PTT performance-tuning techniques) to enhance the performance of servlets and JSP to improve the performance of your Java EE application. The author assumes that the reader has basic servlets and jsps knowledge.
Is your
Example description: Through a form submission page submitted to Servlet,servlet to obtain information, after processing, the information into the request object, if the user submits the name is empty, will return to the home page, otherwise, the submission of all the information displayed
The following specific implementation ~ ~
1, a new Dynamic Web project, named FORMTT
2, a new login interface index.j
The essence of 1.jsp is that SERVLET,JVM can only recognize the Java class, does not recognize the JSP code, the Web container compiles the JSP code to the JVM to recognize the Java class;2.js
you do not need HttpSession on the JSP page, to save performance overhead, use the following page command to avoid automatically creating an HttpSession object:
1) do not store large object graphs in HttpSession: If you store data as a large object graph in HttpSession, the application server will have to process the entire HttpSession object each time. This will force Java serialization and increase compu
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.