Recent Posts
-
JSP Request. Getrequestedsessionid() method: get the session ID value of the website visited by the client
getRequestedSessionId() Example <% out.println(request.getRequestedSessionId()); %> -
Java Set. Add() method: adds an object to the set collection
add(E e) Example public static void main(String[] args){ Set set = new HashSet(); //定义Set集合对象 set.a…… -
JSP Response. Adddateheader() method: add the date header information of the corresponding name
addDateHeader(String name,long date) Example <% long date = System.currentTimeMillis(); response.addDateHea…… -
JSP Request. Getserverpath() method: get the file path of the page requested by the client
getServletPath() Example <% String path = request.getServletPath(); out.println("访问的页面文件的路径为:"+p…… -
JSP Out. Getremaining () method: get the remaining space of the buffer
getRemaining() Example <% int size = out.getRemaining(); out.println("JSP页面的剩余缓冲区大小为:"+size)…… -
JSP Exception. Initcause() method: sets the exception information of initialization
initCause(Throwable cause) Example <%@page language="java" pageEncoding="GBK" errorPage="error.jsp"%> <%…… -
JSP Page. Hashcode () method: returns the hash code value of the object
hashCode() Example <% out.print(page.hashCode()); %> -
Java Map. Isempty() method: judge whether the map collection object contains content
isEmpty() Example public static void main(String[] args){ System.out.println("创建Map集合对象"); Map map =…… -
JSP Response. Addcookie() method: add cookie object
addCookie(Cookie cookie) Example <% Cookie cookie = new Cookie("user","lzw"); response.addCookie(cookie); …… -
Java List. Get () method: get the element at the specified position in the list
get(int index) Typical application public static void main(String[] args){ List<String>list = new ArrayLi…… -
JSP Request. Getattributenames() method: returns the name collection of all attributes
getAttributeNames() Example <% request.setAttribute("name","zs"); //设置name属性 request.setAttribute("age…… -
Jsp: getproperty: data acquisition tag
Example <jsp:useBean id="date" class="java.util.Date" scope="session"/> //获取月份的属性 <jsp:getPrope…… -
JSP Out. Getbuffersize() method: get the size of the output stream buffer
getBufferSize() Example <% int size = out.getBufferSize(); out.println("JSP页面的缓冲区大小为:"+size); …… -
Java Map. Clear() method: removes all mapping relationships from the map collection
clear() Example public static void main(String[] args){ Map map = new HashMap(); //定义Map集合 map.put("昨天"…… -
JSP Page. Equals () method: compare two objects
equals(Object obj) Example <% boolean b = page.equals(page); out.print(b); %> -
Java format() method: format string
Grammar 1 format(String format,Object……args) Example String str = String.format("%d",400/2); String str2 = String.f…… -
Java replace() method: string replacement
Grammar 1 replace(char oldChar,char newChar); Example String str = "C语言中文网"; str = str.replace("C语言中文网","…… -
Java Set. Toarray() method: create an array with all the objects in the set collection
Grammar 1 toArray() Example public static void main(String[] args){ Set set = new HashSet(); //定义Set集合对象…… -
Java Connection. Setautocommit() method: sets the commit mode of the database connection
setAutoCommit(Boolean autoCommit) Example Connection conn = …… //省略部分代码 conn.setAutoCommit(false); -
JSP application. Getnameddispatcher() method: returns the requestdispatcher object according to the specified parameter name
getNamedDispatcher(String name) Example <% RequestDispatcher rd=application.getNamedDispatcher("test2"); rd…… -
JSP Out. Clearbuffer () method: clear the data in the buffer and output it to the client
clearBuffer() Example <% out.println("C语言中文网"); out.clearBuffer(); %> -
JSP Request. Getcontextpath() method: returns the directory where the current web is located
getContextPath() Example <% out.print(request.getContextPath()); %> -
JSP application. Getminorversion() method: returns the minimum version number of servlet API supported by the server
getMinorVersion() Example <% int i = application.getMinorVersion(); //获取服务器支持的Servlet API最小版本号 …… -
Java Map. Keyset() method: get all the key names of the map set
keySet() Typical application public static void main(String[] args){ Map map = new HashMap(); //定义Map集合 …… -
JSP Request. Getmethod () method: get the method that the client transmits data to the server
getmethod() Example <% String mName = request.getmethod(); out.println("表单提交请求使用的方法是:"+mName); …… -
JSP Request. Getintheader () method: get the corresponding header information in the client request
getIntHeader(String name) Example <% out.println(request.getIntHeader("Expires")); %> -
Java List. Remove() method: removes the specified element from the list
Grammar 1 remove(int index) Example public static void main(String[] args){ List<String>list = new ArrayL…… -
JSP application. Getmimitype() method: returns the MIME type of the specified file
getMimeType(String file) Example <% out.print(application.getMimeType("photo.jpg")); %> 运行结果如下: i…… -
Java indexof() method: returns the index position of the first occurrence
Grammar 1 indexOf(int ch) Example String strCom = "I like java"; int index = strCom.indexOf(5); Grammar 2 indexOf(i…… -
Java UDP communication: Java datagram socket class and datagram packet class
Datagram packet class Datagram socket class Example 1 public static void main(String[] args) { DatagramSocket …… -
Java List. Iterator () method: iterates over the list elements
iterator() Typical application public static void main(String[] args){ List<String>list = new ArrayList&l…… -
JSP application. Log() method: write information to the log file of the servlet
Syntax 1: log(String msg) Example <% application.log("specified message"); %> Grammar 2 log(String message……