Recent Posts
-
JSP Request. Getcookies() method: get cookie object
getCookies() Example <% Cookie[] cookies = request.getCookies(); out.println("客户端包含"+cookies.length+"…… -
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=…… -
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 Out. Isautoflush() method: judge whether the buffer is refreshed automatically
isAutoFlush() Example <% int size = out.getRemaining(); out.println("JSP页面是否自动刷新:"+out.isAutoFl…… -
Java stop (terminate) thread detailed version
Unstoppable thread Example 1 package ch14; public class MyThread13 extends Thread { @Override public vo…… -
JSP Exception. Printstacktrace() method: outputs abnormal stack trace
Grammar 1 printStackTrace() Example <%@page language="java" errorPage="error.jsp" pageEncoding="GBK"%> <…… -
JSP config. Getinitparameter() method: get the value of the initial parameter
getInitParameter(String name) Example <% String name = config.getInitParameter("fork"); out.println("parame…… -
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: …… -
Role of Java currentthread() method
Example 1 public class Run1 { public static void main(String[] args) { //调用currentThread()方法…… -
Java List. Clear() method: removes all elements from the list
clear() Example public static void main(String[] args){ List<String>list = new ArrayList<String>();…… -
Java Map. Containskey() method: judge whether the map collection object contains the specified key name
containsKey(Object key) Typical application public static void main(String[] args){ Map map = new HashMap(); //…… -
Jsp: include: the page contains tags
Example <%@page contentType="text/html;charset=gb2312"%>//将top.jsp文件包含进来 <jsp:include …… -
JSP Request. Getuserprincipal() method: returns Java security. Principal object
getUserPrincipal() Example <% Principal p = request.getUserPrincipal(); %> -
Java length() method: get the length of the string
length(); Example String strCom2="C语言中文网"; int length=strCom2.length(); Typical application Define the string …… -
Jsp: setproperty: property value setting tag
< jsp: setproperty name = "bean instance name" {property = "*" | property = "propertyname" | property = "propertyna…… -
JSP Page. GetClass () method: get the page object
getClass() Example <% out.println("当前JSP页面的类是:"+page.getClass()); %> -
Solutions to Java non thread safety problems
package ch14; public class LoginCheck { private static String username; private static String password;…… -
Java Set. Contains() method: judge whether the set set contains the specified object
contains(Object o) Typical application public static void main(String[] args){ Set set = new HashSet(); se…… -
Java DriverManager. Println() method: output log
println(String message) Example DriverManager.println("获取驱动成功!"); -
JSP Out. Flush() method: clear the current buffer
flush() Example <% out.println("C语言中文网"); out.flush(); %> -
Java TCP communication: Java ServerSocket class and socket class
ServerSocket class Construction method of ServerSocket try { ServerSocket serverSocket=new ServerSocket(8111);…… -
Java DriverManager. Println() method: output log
println(String message) Example DriverManager.println("获取驱动成功!"); -
What is JSP? What are the advantages of JSP?
1) Precompiled 2) Separation of business codes 3) Component reuse 4) Cross platform -
JSP Request. Isrequestedsessionidvalid() method: Returns whether the session is valid
isRequestedSessionIdValid() Example <% out.println("Session是否有效"+request.isRequestedSessionIdValid()); %&…… -
JSP Response. Addinthead() method: add the int attribute of the corresponding name
addIntHeader(String name,int value) Example <% response.addIntHeader("Expires",10); %> -
Java Map. Put() method: get all the key names of the map collection
put(K key,V value) Example public static void main(String[] args)throws InterruptedException{ Map map = new Has…… -
JSP Request. Getcontentlength() method: get the length of the requested body
getContentLength() Example <% int len = request.getContentLength(); out.println("请求内容的长度为:"+len); …… -
JSP PageContext. Getattribute () method: retrieves the attribute within the specified range
getAttribute(String name,int scope) Example <% pageContext.getAttribute("user",pageContext.SESSION_SCOPE); …… -
JSP include instruction: the instruction that contains the file
<%@include file="file url"%> <%@include file = "welcome.jsp?name=yxq"%> Example <%@include file = "welc…… -
JSP Request. Getheaders () method: returns all the values of the request header with the specified name
getHeaders(String name) Example <% Enumeration cts = request.getHeaders("accept-encoding"); while(cts.hasMo…… -
Java Connection. Close() method: close the connection object
close() Example Connection conn = …… //省略部分代码 conn.close(); //将连接关闭 -
JSP Response. Setheader() method: set header information
setHeader(String name,value) Example <% out.println(new Date()); response.setHeader("Refresh","1"); %> ……