• JSP reads the parameters of connecting to the database from web. XML


    JSP or servlet page code: Copy codeThe code is as follows: String driver = application. getIni tParameter (“driver”) ; String url = application.getInitParameter(“url”); String user = application.getInitParameter(“user”); String pass = application.getInitParameter(“pass”); Web.xml needs to read: Copy codeThe code is as follows: <context-param> <param-name>driver</param-name> <param-value>com.mysql.jdbc.Driver</param-value> </context-param> <context-param> <param-name>url</param-name> <param-value>jdbc:mysql://localhost:3306/j2ee</param-value> </context-param> <context-param> <param-name>user</param-name> <param-value>root</param-value> </context-param> <context-param> <param-name>pass</param-name> […]

  • Function and basic configuration of JSP web.xml file


    There can be no web.xml file in a web, that is to say, web.xml file is not necessary for Web engineering. When do we need it and when can we not?To answer the above question, you need to understand what the web. XML file is used for. The web.xml file is used to configure: Welcome […]

  • Session expiration setting and its application in JSP web.xml Configuration learning


    The expiration time of session needs to be configured in Tomcat web.xml Time is measured in minutes. Another maximum time seems to be 24 hours. That is to say, your session expiration time can be set to 1440. If it is set to 1441, it is invalid. (not tested yet) Copy codeThe code is as […]

  • About JSP configuration files web.xml Detailed explanation of loading sequence


    1 1. When starting a web project, the web container will read its configuration fileweb.xml, read<context-param>And<listener>Two nodes. 2. Urgent, let’s create oneServletContext(servlet context), which is shared by all parts of the web project. 3. The container converts < context param > to a key value pair and gives it to theservletContext。 4. The container creates […]