• Solution to the problem that JSP can’t connect to SQL Server 2008


    1. First of all, if you encounter javax.servlet.ServletException : java.lang.ClassNotFoundException : com.microsoft.jdbc . sqlserver.SQLServerDriver This is a mistake, So you should Class.forName (” com.microsoft.jdbc . sqlserver.SQLServerDriver “); Change to Class.forName (” com.microsoft.sqlserver . jdbc.SQLServerDriver “); 2. When the error is javax.servlet.ServletException : java.sql.SQLException : No suitable driver found for jdbc:microsoft : sqlserver://localhost : 1034; databasename […]

  • (JSP / HTML) embedded player on Web page


    This is actually very simple, as long as you add the above code to the HTML, it is OK, provided that your computer has installed a player, such as realplay. Copy codeThe code is as follows: < embedded SRC = “C] / MP3 / 10.19/heart painting. Mp3” width = “480” height = “100” 02. Loop […]

  • be based on jsp:included The use and application of jsp:param Solutions to garbled code


    If jsp:include If the page in is garbled, you need to use the< jsp:include page= After < body > in the “>” page<%    request.setCharacterEncoding (‘utf-8 ‘); / / or specified encoding (GBK or other)%>As shown below: Copy codeThe code is as follows: jsp-include.jsp<%@ page language=”java” contentType=”text/html;charset=UTF-8″ %><html>< head > < title > JSP include test […]

  • JSP page Chinese transfer parameters using escape encoding


    Today, when using Chinese to pass parameters, I encountered that the code could not be changed. So I thought of using escaperequest.getParameter Unable to receive parameters, I thought about how to receive parameters.After the test, it passed Copy codeThe code is as follows: Zbtmp = escape (escape (zbtmp)); / / encrypt danielinbiti twicevar params = […]

  • JSP custom tag technology (implementation principle, code and platform building steps)


    Due to the requirement of JSP code specification, a sentence of Java code cannot appear. All have JSP custom tag technology.So the custom tag technology of JSP is to remove the Java code in JSP. At the same time, the personal feeling of encapsulation label is also a kind of security embodiment, which does not […]

  • How to use Select tag to cascade in JSP page


    Do query page, query conditions are more often involved in the cascade. For a simple example, take the educational administration system as an example. We need to query the teaching plan information. The query criteria are enrollment batch, student level (from college to college), major and course. What is the cascading relationship between them?The enrollment […]

  • An example of solving the problem of Chinese garbled code in JSP


    In JSP, we often read data from the database and return it to the client, but we often have garbled code when we make it, so we can use <% request.setCharacterEncoding (“UTF-8”);% > this method is used to ensure the correct output of Chinese. Let’s take an example,Before we take the value of the form […]

  • Discussion on shielding backspace key in JSP


    Today, a problem is involved. In the query criteria of JSP, there are text boxes to input filter criteria, and drop-down boxes to select filter criteria. The content in the input box can be deleted by pressing the “backspace” key, but the backspace function needs to be shielded in the drop-down box, otherwise the page […]

  • The specific instance of displaying ArrayList to JSP page in action


    1、 The ArrayList object obtained from the useraction is filled into the userform, and the JSP page obtains the initial value of the userform.Part of the code of useraction: Copy codeThe code is as follows: private ActionForward executeManageAction(ActionMapping mapping, ActionForm form,   HttpServletRequest request, HttpServletResponse response) {  UserForm userForm = (UserForm)form;  ArrayList userlist = new ArrayList();  […]

  • Seven ways to improve response speed in JSP pages


    Method 1: cache data in init () method of servletAfter the application server initializes the servlet instance, it calls the init () method of the servlet before serving the client request. The init () method is called only once in the life cycle of a servlet. By caching some static data in init () method […]

  • How to calculate the relative path of JSP


    Problem Description: In / JSP/ index.jsp Files use pictures, how to calculate the relative path? How to calculate the relative path after forwarding by servlet and struts? Directory structure: App Name: Demo demo —-webroot —-images —-go.gif —-jsp —-index.jsp —-css —————————————————————————— The first case: direct access to JSP files The URL is http://localhost/Context path/jsp/ index.jsp To […]

  • 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 […]