Java
-
Comparison of Java strings (equals(), equalsignorecase(), compareto())
Equals() method 字符串1.equals(字符串2); String str1="abc"; String str2=new String("abc"); String str3="ABC"; S…… -
What is JSP? What are the advantages of JSP?
1) Precompiled 2) Separation of business codes 3) Component reuse 4) Cross platform -
JSP config. Getinitparameter() method: get the value of the initial parameter
getInitParameter(String name) Example <% String name = config.getInitParameter("fork"); out.println("parame…… -
JSP PageContext. Forward() method: forward page
forward(String relativeUrlPath) Example <% pageContext.forward("count.jsp"); %> Typical application &l…… -
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…… -
JSP Request. Getcharacterencoding() method: returns the character encoding format
getCharacterEncoding() Example <% String encoding = request.getCharacterEncoding(); out.println("请求页面的…… -
JSP Request. Getauthtype () method: returns the authentication scheme name of the protection servlet
getAuthType() Example <% out.print(request.getAuthType()); %> -
JSP application. Getminorversion() method: returns the minimum version number of servlet API supported by the server
getMinorVersion() Example <% int i = application.getMinorVersion(); //获取服务器支持的Servlet API最小版本号 …… -
JSP Page. Hashcode () method: returns the hash code value of the object
hashCode() Example <% out.print(page.hashCode()); %> -
JSP Out. Print () method: output data to JSP page
Grammar 1 print(boolean b) Example <% out.print(3>2); %> Grammar 2 print(char c) Example <% …… -
JSP application. Getresource () method: get the URL path of the specified resource
getResource(String path) Example <% URL url=application.getResource("index.jsp"); out.println(url); %> -
Java DriverManager. Println() method: output log
println(String message) Example DriverManager.println("获取驱动成功!"); -
JSP Exception. Printstacktrace() method: outputs abnormal stack trace
Grammar 1 printStackTrace() Example <%@page language="java" errorPage="error.jsp" pageEncoding="GBK"%> <…… -
JSP application. Setattribute() method: set attribute
setAttribute(String name,Object object) Example <% application.setAttribute("user","lzw"); Date Now = new D…… -
JSP PageContext. Setattribute() method: set attribute
setAttribute(String name,Object value,int scope) Example <% pageContext.setAttribute("user","lzw",pageContext.…… -
JSP PageContext. Include () method: include the file in the page
Grammar 1 include(String relativeUrlPath) Example <%@page language="java" pageEncoding="GBK"%> <% …… -
Java Set. Remove() method: removes the specified object from the set collection
remove(Object o) Typical application public static void main(String[] args){ Set set = new HashSet(); //定义Se…… -
JSP Request. Getcontextpath() method: returns the directory where the current web is located
getContextPath() Example <% out.print(request.getContextPath()); %> -
JSP Exception. Initcause() method: sets the exception information of initialization
initCause(Throwable cause) Example <%@page language="java" pageEncoding="GBK" errorPage="error.jsp"%> <%…… -
JSP Request. Getquerystring() method: get query string
getQueryString() Example <a href="https://www.jb51.ccindex.jsp?JavaCore">以Get方法发送的查询字符串</a>&l…… -
How to learn java for beginners (with java learning route)
Java learning route Java EE beginner Java EE intermediate Java EE advanced -
Java TCP communication: Java ServerSocket class and socket class
ServerSocket class Construction method of ServerSocket try { ServerSocket serverSocket=new ServerSocket(8111);…… -
Java stop (terminate) thread detailed version
Unstoppable thread Example 1 package ch14; public class MyThread13 extends Thread { @Override public vo…… -
JSP application. Getresourceasstream() method: returns the input stream object of the specified resource
getResourceAsStream(String path) Example <% InputStream in = application.getResourceAsStream("index.jsp"); %&…… -
JSP PageContext. Removeattribute() method: removes the attribute from the specified range object
removeAttribute(String name,int scope) Example <% pageContext.removeAttribute("user",pageContext.APPLICATION_S…… -
Java pause / suspend thread (suspend()) and resume thread (resume())
Suspend() and resume() methods package ch14; public class MyThread21 extends Thread { private long i=0; …… -
Java trim() method: remove the spaces before and after the string
trim() Example public static void main(String[] args){ String strCom = "JAVA编程词典"; //定义字符串 Strin…… -
JSP Out. Clearbuffer () method: clear the data in the buffer and output it to the client
clearBuffer() Example <% out.println("C语言中文网"); out.clearBuffer(); %> -
JSP Out. Getremaining () method: get the remaining space of the buffer
getRemaining() Example <% int size = out.getRemaining(); out.println("JSP页面的剩余缓冲区大小为:"+size)…… -
JSP application. Getattribute () method: get attribute value
getAttribute(String name) Example <% application.getAttribute("user"); %> Typical application <body&g…… -
JSP Request. Getpathtranslated() method: get the path information of the URL
getPathTranslated() Example <% out.println(request.getPathTranslated()); %> -
JSP Out. Flush() method: clear the current buffer
flush() Example <% out.println("C语言中文网"); out.flush(); %>