包含标签:Java 的文章
-
Jsp: setproperty: property value setting tag
< jsp: setproperty name = "bean instance name" {property = "*" | property = "propertyname" | property = "propertyna…… -
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"); …… -
Implementation of Java multithreading
Inherit thread class public class Thread implements Runnable public class NewThreadName extends Thread { //New…… -
JSP PageContext. GetException () method: get the current exception object
getException() Example <%@page language="java" errorPage="error.jsp" pageEncoding="GBK"%> <% Integ…… -
JSP PageContext. Getsession () method: returns the current session object
getSession() Example <% HttpSession s = pageContext.getSession(); s.setAttribute("user","C语言中文网"); %&…… -
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 Page. Equals () method: compare two objects
equals(Object obj) Example <% boolean b = page.equals(page); out.print(b); %> -
Java Connection. Commit() method: commit the transaction
commit() Example Connection conn = …… //省略部分代码 conn.setAutoCommit(false); //先将事务设为手动提交 Statement…… -
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 length() method: get the length of the string
length(); Example String strCom2="C语言中文网"; int length=strCom2.length(); Typical application Define the string …… -
JSP Request. Getdateheader () method: get the long value of the build date object
getDateHeader(String name) Example <% out.println(request.getDateHeader("Expires")); %> -
Other println methods for JSP out objects
public abstract void println(boolean b)throws IOException public abstract void println(char c)throws IOException publi…… -
Java substring() method: evaluate substring (intercept string)
Grammar 1 substring(int beginIndex) Example String strCom = "I Like Java"; String strResult = strCom.substring(3); …… -
JSP application. Getrealpath() method: get the real path of the virtual path
getRealPath(String path) Example <% String path=application.getRealPath("index.jsp"); out.println(path); %…… -
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 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("昨天"…… -
What is a URL? And URL class and urlconnection class
URL concept protocol://resourceName http://www.sun.com/ 协议名://主机名 http://localhost:8080/Test/admin/logi…… -
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. Getuserprincipal() method: returns Java security. Principal object
getUserPrincipal() Example <% Principal p = request.getUserPrincipal(); %> -
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>(); …… -
Java DriverManager. Getlogwriter() method: get the printout stream of the log
getLogWriter() Example PrintWriter out=null; out=DriverManager.getLogWriter(); if(out!=null){ out.println("得到…… -
Java List. Addall() method: adds all elements to the list
Grammar 1 addAll(Collectionc) Example public static void main(String[] args){ List<String>list = new Arra…… -
Java Map. Putall() method: append another map object to the current map collection
putAll(Mapm) Typical application public static void main(String[] args){ Map map1 = new HashMap(); //定义Map集…… -
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…… -
JSP Out. Getbuffersize() method: get the size of the output stream buffer
getBufferSize() Example <% int size = out.getBufferSize(); out.println("JSP页面的缓冲区大小为:"+size); …… -
JSP Request. Getrequesturi () method: get the relative path of the website accessed by the client
getRequestURI() Example <% String p = request.getRequestURI(); out.println("访问的URI路径为:"+p); %> -
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: the page contains tags
Example <%@page contentType="text/html;charset=gb2312"%>//将top.jsp文件包含进来 <jsp:include …… -
JSP PageContext. Getservletcontext () method — returns an instance of ServletContext
getServletContext() Example <% ServletContext sc = pageContext.getServletContext(); %> -
Java replaceall() method: replace all matching strings
replaceAll(String regex,String replacement) Example String str = "成功者找方法,"; //定义字符串 str = str.replaceAl…… -
Java Map. Containsvalue() method: judge whether the map collection contains the specified key value
containsValue(Object value) Example public static void main(String[] args){ Map map = new HashMap(); //定义Map…… -
Java Connection. Rollback() method: transaction rollback
Grammar 1 rollback() Example Connection conn = …… //省略部分代码 conn.setAutoCommit(false); //先将事务设为手动提……