• Explain in detail how Tomcat implements asynchronous servlets


    preface Through my previous Tomcat series articles, I believe the students who read my blog should have a clear understanding of Tomcat. In the previous blogs, we discussed how Tomcat is started in the springboot framework, how the internal components of Tomcat are designed and how the request flows. Then, let’s talk about the asynchronous […]

  • Page reorientation in jsp servlet


    1. RequestDispatcher.forward() It works on the server side. When forward() is used, the servlet engine transmits HTTP requests from the current servlet or JSP to another servlet, JSP or ordinary HTML file. In other words, your form is submitted to a.jsp. In a.jsp, forward() is used to redirect to b.jsp. At this time, all the […]

  • Solution to prompt downloading when accessing JSP file or servlet file


    As shown in the figure below:The same program, some browser error, some browser error. The cause of the error is the wrong code to set the MIME type.If it is a JSP file, look at the file header: Copy codeThe code is as follows: <%@ page contentType=”text/html;charset=gb2312″%> If it’s a servlet file, check: Copy codeThe […]

  • Struts 2 accessing servlet sharing


    1: Access or add the request / session / application property  Copy codeThe code is as follows: public String scope() throws Exception{    ActionContext ctx = ActionContext.getContext(); ctx.getApplication (). Put (“app”, “application scope”); / / put the app into ServletContext ctx.getSession (). Put (“session”, “session range”); / / put session into session ctx.put (“req”, “request […]

  • Detailed explanation of servlet dynamic web page technology


    1、 Introduction to servlet:With the gradual popularization of Internet technology, as well as people’s increasing demand for the Internet, the previous kind of static web page is no longer suitable. We see that today’s web page not only has flash, video and so on, obviouslyIn order to solve this problem, Sun company provides a technology […]

  • Introduction of JSP and Servlet


    What are servlets and JSPS There are two main technologies used in developing web applications with Java, namely servlet and JSP. A servlet is a java program that executes on the server side. It is called a servletServlet containerIs responsible for executing Java programs. JSP (Java server page) is a page, which is composed ofJSP […]

  • The method of jQuery accessing servlet and returning data to page


    This article describes the method of jQuery accessing servlet and returning data to page. Share with you for your reference. The specific implementation method is as follows: one servlet:AjaxServlet.java As follows: Copy codeThe code is as follows: package com.panlong.servlet;  import java.io.IOException;  import java.io.PrintWriter;  import java.net.URLDecoder;  import javax.servlet.ServletException;  import javax.servlet.http.HttpServlet;  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse;  public class […]

  • Servlet + JSP to upload pictures or files specific ideas and code


    Now, whether it is blog forum or enterprise office, it is inseparable from the sharing of resources. Through the way of file upload, we can share with you, so as to achieve extensive communication and exchange among the public. We can not only gain more knowledge and experience from it, but also achieve the purpose […]

  • Solution of 404 error in submitting JSP to servlet (Webroot subdirectory)


    The first time I used JSP to write something, I wrote JSP in the Webroot subfolder. When I submitted it to servlet, 404 error was reported. I always thought it was the problem of sub file, but it was not. The fact is that the students deleted this code for me, and the JSP file […]

  • Discussion on the difference between JSP and Servlet


    Answer 1: First of all, you need to understand what a servlet is. A servlet is a java program executed on the server side, but it has a special set of rules (that is, what we usually call the API). JSP simply means a servlet program written with another set of simple rules, which can […]

  • JSP reference servlet generated verification code demonstration


    This demo code mainly includes the following three parts:One checkCode.java : used to generate captcha2.checkCodeServlerThree check.jsp Verification Here is checkCode.java The content of Copy codeThe code is as follows: //Used to get four random numbers     private char mapTable[] = {‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9’}; / / generate a verification code and return a randomly generated number     public String getEnsure(int […]

  • Example of java servlet filter


    Introduction to servlet filter      Servlet filter is actually a standard Java class. This class obtains the function of filter by implementing the filter interface. It passes through the JSP container when it starts web.xml The configuration file is loaded by the system.The servlet filter is called when receiving the user’s request. When the server receives […]