Recent Posts
-
JSP Exception. GetMessage () method: get exception message text
getMessage() Example Typical application -
Inheritance of Java classes: simple inheritance of Java and the difference between single inheritance and multi inheritance
Simple inheritance class class_name extends extend_class { //类的主体 } public class Student extends Person…… -
JSP PageContext. Geterrordata() method: returns the errordata object containing the error information
getErrorData() Example <% ErrorData error = pageContext.getErrorData(); %> -
Jsp: plugin: load tag
Example 1 <jsp:plugin type="applet"code="com.applet.MyApplet.class"codebase="/"> <jsp:fallback>加载Ja…… -
JSP PageContext. Removeattribute() method: removes the attribute from the specified range object
removeAttribute(String name,int scope) Example <% pageContext.removeAttribute("user",pageContext.APPLICATION_S…… -
JSP PageContext. Setattribute() method: set attribute
setAttribute(String name,Object value,int scope) Example <% pageContext.setAttribute("user","lzw",pageContext.…… -
Detailed explanation of Java two-dimensional array: Declaration and initialization of two-dimensional array, and obtaining the value of two-dimensional array
Create a 2D array type array[][]; type[][] array; int[][] age; char[][] sex; Initialize 2D array array=new typ…… -
Java Statement. Getgeneratedkeys() method: get the automatically generated key
getGeneratedKeys() Example Connection conn = …… //省略部分代码 Statement stmt = conn.createStatement(); //获取Sta…… -
JSP page instruction: page instruction
<%@page [language="java"] [contentType="mimeType;charset=CHARSET"] [import="{package.class|pageage.*},……"] [extends…… -
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 application. Getmajorversion() method: returns the maximum version number of servlet API supported by the server
getMajorVersion() Example <% int i=application.getMajorVersion(); out.print(i); %> -
Java replaceall() method: replace all matching strings
replaceAll(String regex,String replacement) Example String str = "成功者找方法,"; //定义字符串 str = str.replaceAl…… -
Java DriverManager. Getlogwriter() method: get the printout stream of the log
getLogWriter() Example PrintWriter out=null; out=DriverManager.getLogWriter(); if(out!=null){ out.println("得到…… -
Other println methods for JSP out objects
public abstract void println(boolean b)throws IOException public abstract void println(char c)throws IOException publi…… -
Implementation of Java multithreading
Inherit thread class public class Thread implements Runnable public class NewThreadName extends Thread { //New…… -
JSP Request. Isrequestedsessionidfromcookie() method: judge whether the session ID is obtained from the cookie
isRequestedSessionIdFromCookie() Example <% out.println("from cookie"+request.isRequestedSessionIdFromCookie()…… -
Java ResultSet. GetString () method: get the data of string type
Grammar 1 getString(int columnIndex) Example Connection conn = …… //省略部分代码 String sql = "SELECT username,pwd…… -
Java DriverManager. Getdrivers() method: get all loaded drivers
getDrivers() Typical application public static void main(String[] args){ try{ Class.forName("com.microsoft.s…… -
JSP Out. Close () method: close the output stream of the JSP
close() Example <% out.println("C语言中文网"); out.close(); out.println("JSP页面"); %> -
The role of the Java isalive() method
Example 1 package ch14; public class MyThread08 extends Thread { @Override public void run() { …… -
JSP application. Getresourceasstream() method: returns the input stream object of the specified resource
getResourceAsStream(String path) Example <% InputStream in = application.getResourceAsStream("index.jsp"); %&…… -
JSP application. Setattribute() method: set attribute
setAttribute(String name,Object object) Example <% application.setAttribute("user","lzw"); Date Now = new D…… -
JSP PageContext. Forward() method: forward page
forward(String relativeUrlPath) Example <% pageContext.forward("count.jsp"); %> Typical application &l…… -
JSP PageContext. Handlepageexception() method: throw an exception
Grammar 1 handlePageException(Exception e) Example <%@page language="java" pageEncoding="GBK" errorPage="error.js…… -
JSP PageContext. Release() method: release related resources
release() Example <% pageContext.release(); %> -
JSP Request. Removeattribute() method: deletes an attribute in the request
removeAttribute(String name) Example <% request.removeAttribute("name"); request.removeAttribute("sex"); …… -
JSP PageContext. Getservletcontext () method — returns an instance of ServletContext
getServletContext() Example <% ServletContext sc = pageContext.getServletContext(); %> -
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 Request. Getdateheader () method: get the long value of the build date object
getDateHeader(String name) Example <% out.println(request.getDateHeader("Expires")); %> -
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"); …… -
Java Connection. Createstatement () method: create a statement object
Grammar 1 createStatement() Example Connection conn = …… //省略部分代码 Statement st = conn.createStatement(); Gram……