包含标签:Java 的文章
-
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); //先将事务设为手动提…… -
JSP application. Getmimitype() method: returns the MIME type of the specified file
getMimeType(String file) Example <% out.print(application.getMimeType("photo.jpg")); %> 运行结果如下: i…… -
Jsp: getproperty: data acquisition tag
Example <jsp:useBean id="date" class="java.util.Date" scope="session"/> //获取月份的属性 <jsp:getPrope…… -
JSP Out. Clear() method: clear the data in the buffer
clear() Example <% out.println("C语言中文网"); out.clear(); %> -
JSP Request. Getcontentlength() method: get the length of the requested body
getContentLength() Example <% int len = request.getContentLength(); out.println("请求内容的长度为:"+len); …… -
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 Request. Removeattribute() method: deletes an attribute in the request
removeAttribute(String name) Example <% request.removeAttribute("name"); request.removeAttribute("sex"); …… -
JSP application. Getmajorversion() method: returns the maximum version number of servlet API supported by the server
getMajorVersion() Example <% int i=application.getMajorVersion(); out.print(i); %> -
JSP config. Getservletname() method: get the name of the servlet
getServletName() Example <% String name = config.getServletName(); out.println("Servlet name is:"+name); %…… -
Jsp: fallback: prompt tag
…… < Jsp: fallback > error message < / JSP: fallback >... < / JSP: plugin > is set here Exam…… -
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 Request. Getattributenames() method: returns the name collection of all attributes
getAttributeNames() Example <% request.setAttribute("name","zs"); //设置name属性 request.setAttribute("age…… -
JSP Response. Getcharacterencoding () method: get the character encoding type of the response
getCharacterEncoding() Example <% String encode = response.getCharacterEncoding(); out.println("响应客户端…… -
JSP Response. Addheader() method: add HTTP header information
addHeader(String name,String value) Example <%=new Date()%> <% response.addheader("Refresh","1"); …… -
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…… -
Java List. Clear() method: removes all elements from the list
clear() Example public static void main(String[] args){ List<String>list = new ArrayList<String>();…… -
JSP PageContext. Release() method: release related resources
release() Example <% pageContext.release(); %> -
Detailed explanation of Java one-dimensional array: Java creates one-dimensional array, initializes one-dimensional array, and obtains single / all elements
Create a one-dimensional array 数据类型数组名[]; //声明数组 数据类型[]数组名; //声明数组 int[] score; /…… -
JSP application. Getresourcepaths() method: returns all files in the specified directory
getResourcePaths(String path) Example <% Set set = application.getResourcePaths("/"); //返回装载指定路径列表…… -
JSP Request. Getheadersnames() method: returns the names of all request headers
getHeaderNames() Example <% Enumeration cts = request.getHeaderNames(); while(cts.hasMoreElements()){ ……