Java
-
JSP PageContext. Getrequest () method: get the current request object
getRequest() <% HttpServletRequest req = (HttpServletRequest)pageContext.getRequest(); String name = req.ge…… -
Comparison of Java strings (equals(), equalsignorecase(), compareto())
Equals() method 字符串1.equals(字符串2); String str1="abc"; String str2=new String("abc"); String str3="ABC"; S…… -
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); %> -
How to learn java for beginners (with java learning route)
Java learning route Java EE beginner Java EE intermediate Java EE advanced -
JSP Request. Getpathtranslated() method: get the path information of the URL
getPathTranslated() Example <% out.println(request.getPathTranslated()); %> -
JSP Request. Getservername() method: get the name of the server
getServerName() Example <% String serName = request.getServerName(); out.println("服务器端的名字为:"+serNam…… -
JSP Exception. Fillinstacktrace() method: populates the exception stack trace
fillInStackTrace() Example <%@page language="java" pageEncoding="GBK" errorPage="error.jsp"%> <% I…… -
JSP Response. Getlastaccessedtime() method: get the last access time of the session
getLastAccessedTime() Example <% long timeNum = session.getLastAccessedTime(); Date date = new Date(timeNum…… -
JSP Response. Setheader() method: set header information
setHeader(String name,value) Example <% out.println(new Date()); response.setHeader("Refresh","1"); %> …… -
Java Connection. Close() method: close the connection object
close() Example Connection conn = …… //省略部分代码 conn.close(); //将连接关闭 -
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…… -
JSP include instruction: the instruction that contains the file
<%@include file="file url"%> <%@include file = "welcome.jsp?name=yxq"%> Example <%@include file = "welc…… -
JSP PageContext. Getattribute () method: retrieves the attribute within the specified range
getAttribute(String name,int scope) Example <% pageContext.getAttribute("user",pageContext.SESSION_SCOPE); …… -
JSP Request. Getcontentlength() method: get the length of the requested body
getContentLength() Example <% int len = request.getContentLength(); out.println("请求内容的长度为:"+len); …… -
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 Response. Addinthead() method: add the int attribute of the corresponding name
addIntHeader(String name,int value) Example <% response.addIntHeader("Expires",10); %> -
JSP Request. Isrequestedsessionidvalid() method: Returns whether the session is valid
isRequestedSessionIdValid() Example <% out.println("Session是否有效"+request.isRequestedSessionIdValid()); %&…… -
What is JSP? What are the advantages of JSP?
1) Precompiled 2) Separation of business codes 3) Component reuse 4) Cross platform -
Java DriverManager. Println() method: output log
println(String message) Example DriverManager.println("获取驱动成功!"); -
Java TCP communication: Java ServerSocket class and socket class
ServerSocket class Construction method of ServerSocket try { ServerSocket serverSocket=new ServerSocket(8111);…… -
JSP Out. Flush() method: clear the current buffer
flush() Example <% out.println("C语言中文网"); out.flush(); %> -
Java DriverManager. Println() method: output log
println(String message) Example DriverManager.println("获取驱动成功!"); -
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…… -
Solutions to Java non thread safety problems
package ch14; public class LoginCheck { private static String username; private static String password;…… -
JSP Page. GetClass () method: get the page object
getClass() Example <% out.println("当前JSP页面的类是:"+page.getClass()); %> -
Jsp: setproperty: property value setting tag
< jsp: setproperty name = "bean instance name" {property = "*" | property = "propertyname" | property = "propertyna…… -
Java length() method: get the length of the string
length(); Example String strCom2="C语言中文网"; int length=strCom2.length(); Typical application Define the string …… -
JSP Request. Getuserprincipal() method: returns Java security. Principal object
getUserPrincipal() Example <% Principal p = request.getUserPrincipal(); %> -
Jsp: include: the page contains tags
Example <%@page contentType="text/html;charset=gb2312"%>//将top.jsp文件包含进来 <jsp:include …… -
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(); //…… -
Java List. Clear() method: removes all elements from the list
clear() Example public static void main(String[] args){ List<String>list = new ArrayList<String>();…… -
Role of Java currentthread() method
Example 1 public class Run1 { public static void main(String[] args) { //调用currentThread()方法……
