Java
-
Jsp: forward: request forwarding tag
The < jsp: param > sub tag is used to pass parameters to the dynamic target file. The key codes are as follows: …… -
JSP config. Getinitparameter() method: get the value of the initial parameter
getInitParameter(String name) Example <% String name = config.getInitParameter("fork"); out.println("parame…… -
JSP Exception. Printstacktrace() method: outputs abnormal stack trace
Grammar 1 printStackTrace() Example <%@page language="java" errorPage="error.jsp" pageEncoding="GBK"%> <…… -
Java stop (terminate) thread detailed version
Unstoppable thread Example 1 package ch14; public class MyThread13 extends Thread { @Override public vo…… -
JSP Out. Isautoflush() method: judge whether the buffer is refreshed automatically
isAutoFlush() Example <% int size = out.getRemaining(); out.println("JSP页面是否自动刷新:"+out.isAutoFl…… -
Java super keyword: Super calls the constructor of the parent class and uses super to access the members of the parent class
Use super to call the constructor of the parent class super(parameter-list); public People(String name,int age,Str…… -
JSP Request. Getheader () method: get the file header defined by HTTP protocol
getHeader(String name) Example <% String ct = request.getHeader("content-type"); out.println("Content-type=…… -
JSP Request. Getcookies() method: get cookie object
getCookies() Example <% Cookie[] cookies = request.getCookies(); out.println("客户端包含"+cookies.length+"…… -
Java Connection. Createstatement () method: create a statement object
Grammar 1 createStatement() Example Connection conn = …… //省略部分代码 Statement st = conn.createStatement(); Gram…… -
JSP Response. Containsheader() method: judge whether the HTTP file header with the specified name already exists
addIntHeader(String name,int value) Example <%=new Date()%> <% response.addheader("Refresh","1"); …… -
JSP Request. Getdateheader () method: get the long value of the build date object
getDateHeader(String name) Example <% out.println(request.getDateHeader("Expires")); %> -
Java List. Size () method: returns the number of elements in the list
size() Example public static void main(String[] args){ List<String>list = new ArrayList<String>(); …… -
JSP PageContext. Getservletcontext () method — returns an instance of ServletContext
getServletContext() Example <% ServletContext sc = pageContext.getServletContext(); %> -
JSP Request. Removeattribute() method: deletes an attribute in the request
removeAttribute(String name) Example <% request.removeAttribute("name"); request.removeAttribute("sex"); …… -
JSP PageContext. Release() method: release related resources
release() Example <% pageContext.release(); %> -
JSP PageContext. Handlepageexception() method: throw an exception
Grammar 1 handlePageException(Exception e) Example <%@page language="java" pageEncoding="GBK" errorPage="error.js…… -
JSP PageContext. Forward() method: forward page
forward(String relativeUrlPath) Example <% pageContext.forward("count.jsp"); %> Typical application &l…… -
JSP application. Setattribute() method: set attribute
setAttribute(String name,Object object) Example <% application.setAttribute("user","lzw"); Date Now = new D…… -
JSP application. Getresourceasstream() method: returns the input stream object of the specified resource
getResourceAsStream(String path) Example <% InputStream in = application.getResourceAsStream("index.jsp"); %&…… -
The role of the Java isalive() method
Example 1 package ch14; public class MyThread08 extends Thread { @Override public void run() { …… -
JSP Out. Close () method: close the output stream of the JSP
close() Example <% out.println("C语言中文网"); out.close(); out.println("JSP页面"); %> -
Java DriverManager. Getdrivers() method: get all loaded drivers
getDrivers() Typical application public static void main(String[] args){ try{ Class.forName("com.microsoft.s…… -
Java ResultSet. GetString () method: get the data of string type
Grammar 1 getString(int columnIndex) Example Connection conn = …… //省略部分代码 String sql = "SELECT username,pwd…… -
JSP Request. Isrequestedsessionidfromcookie() method: judge whether the session ID is obtained from the cookie
isRequestedSessionIdFromCookie() Example <% out.println("from cookie"+request.isRequestedSessionIdFromCookie()…… -
Implementation of Java multithreading
Inherit thread class public class Thread implements Runnable public class NewThreadName extends Thread { //New…… -
Other println methods for JSP out objects
public abstract void println(boolean b)throws IOException public abstract void println(char c)throws IOException publi…… -
Java DriverManager. Getlogwriter() method: get the printout stream of the log
getLogWriter() Example PrintWriter out=null; out=DriverManager.getLogWriter(); if(out!=null){ out.println("得到…… -
Java replaceall() method: replace all matching strings
replaceAll(String regex,String replacement) Example String str = "成功者找方法,"; //定义字符串 str = str.replaceAl…… -
JSP application. Getmajorversion() method: returns the maximum version number of servlet API supported by the server
getMajorVersion() Example <% int i=application.getMajorVersion(); out.print(i); %> -
Detailed explanation of Java one-dimensional array: Java creates one-dimensional array, initializes one-dimensional array, and obtains single / all elements
Create a one-dimensional array 数据类型数组名[]; //声明数组 数据类型[]数组名; //声明数组 int[] score; /…… -
JSP page instruction: page instruction
<%@page [language="java"] [contentType="mimeType;charset=CHARSET"] [import="{package.class|pageage.*},……"] [extends……
