包含标签:Java 的文章
-
Java stop (terminate) thread detailed version
Unstoppable thread Example 1 package ch14; public class MyThread13 extends Thread { @Override public vo…… -
JSP application. Getresourceasstream() method: returns the input stream object of the specified resource
getResourceAsStream(String path) Example <% InputStream in = application.getResourceAsStream("index.jsp"); %&…… -
JSP PageContext. Removeattribute() method: removes the attribute from the specified range object
removeAttribute(String name,int scope) Example <% pageContext.removeAttribute("user",pageContext.APPLICATION_S…… -
Java pause / suspend thread (suspend()) and resume thread (resume())
Suspend() and resume() methods package ch14; public class MyThread21 extends Thread { private long i=0; …… -
Java trim() method: remove the spaces before and after the string
trim() Example public static void main(String[] args){ String strCom = "JAVA编程词典"; //定义字符串 Strin…… -
JSP Out. Clearbuffer () method: clear the data in the buffer and output it to the client
clearBuffer() Example <% out.println("C语言中文网"); out.clearBuffer(); %> -
JSP Out. Getremaining () method: get the remaining space of the buffer
getRemaining() Example <% int size = out.getRemaining(); out.println("JSP页面的剩余缓冲区大小为:"+size)…… -
JSP application. Getattribute () method: get attribute value
getAttribute(String name) Example <% application.getAttribute("user"); %> Typical application <body&g…… -
JSP Request. Getpathtranslated() method: get the path information of the URL
getPathTranslated() Example <% out.println(request.getPathTranslated()); %> -
JSP Out. Flush() method: clear the current buffer
flush() Example <% out.println("C语言中文网"); out.flush(); %> -
JSP Out. Isautoflush() method: judge whether the buffer is refreshed automatically
isAutoFlush() Example <% int size = out.getRemaining(); out.println("JSP页面是否自动刷新:"+out.isAutoFl…… -
The role of the Java isalive() method
Example 1 package ch14; public class MyThread08 extends Thread { @Override public void run() { …… -
Jsp: plugin: load tag
Example 1 <jsp:plugin type="applet"code="com.applet.MyApplet.class"codebase="/"> <jsp:fallback>加载Ja…… -
Java DriverManager. Getconnection() method: get database connection
Grammar 1 getConnection(String url) Example public Connection getConnection(){ Connection con=null; try{ …… -
Java tochararray() method: converts a string into a character array
tocharArray() Example public static void main(String[] args){ String strCom = "JAVA编程词典"; //定义字符串 …… -
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 Request. Getserverpath() method: get the file path of the page requested by the client
getServletPath() Example <% String path = request.getServletPath(); out.println("访问的页面文件的路径为:"+p…… -
JSP Request. Getservername() method: get the name of the server
getServerName() Example <% String serName = request.getServerName(); out.println("服务器端的名字为:"+serNam…… -
Java DriverManager. Println() method: output log
println(String message) Example DriverManager.println("获取驱动成功!"); -
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. Close () method: close the output stream of the JSP
close() Example <% out.println("C语言中文网"); out.close(); out.println("JSP页面"); %> -
JSP PageContext. Geterrordata() method: returns the errordata object containing the error information
getErrorData() Example <% ErrorData error = pageContext.getErrorData(); %> -
JSP PageContext. Getpage () method: returns the current page object
getPage() Example <% page = pageContext.getPage(); %> -
JSP Request. Getrequesturl () method: get the absolute path of the client accessing the website
getRequestURI() Example <% StringBuffer p = request.getRequestURL(); out.println("访问的URL路径为:"+p); %&…… -
Java Connection. Setautocommit() method: sets the commit mode of the database connection
setAutoCommit(Boolean autoCommit) Example Connection conn = …… //省略部分代码 conn.setAutoCommit(false); -
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 Exception. Fillinstacktrace() method: populates the exception stack trace
fillInStackTrace() Example <%@page language="java" pageEncoding="GBK" errorPage="error.jsp"%> <% I…… -
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…… -
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 DriverManager. Getdrivers() method: get all loaded drivers
getDrivers() Typical application public static void main(String[] args){ try{ Class.forName("com.microsoft.s…… -
Inheritance of Java classes: simple inheritance of Java and the difference between single inheritance and multi inheritance
Simple inheritance class class_name extends extend_class { //类的主体 } public class Student extends Person…… -
Java DriverManager. Getdriver () method: select an appropriate driver
getDriver(String url) Example Class.forName("com.MysqL.jdbc.Driver"); //注册MysqL驱动 String url = "jdbc:MysqL://l……