Servlet 是個中間件,負責讀取客戶端信息(顯示信息/隱式信息),通過操作最后返回結果
package?javax.servlet;

import?java.io.IOException;

//?Referenced?classes?of?package?javax.servlet:
//????????????ServletException,?ServletConfig,?ServletRequest,?ServletResponse

public?interface?Servlet?????????????????? //單列模式,即服務器之創(chuàng)建一個servlet實例
{

????
public?abstract?void?init(ServletConfig?servletconfig)???throws?ServletException;????????? //初始化,首次創(chuàng)建servlet時調用,
?? ?
public?abstract?ServletConfig?getServletConfig();???????????? //獲取持久屬性
???
public?abstract?void?service(ServletRequest?servletrequest,?ServletResponse?servletresponse)???? ?throws?ServletException,?IOException;? //允許多個線程并發(fā)訪問,服務器接收到Http請求時,就會調用該方法,由該方法負責調用dopost/doget/.......等方法。
????????
public?abstract?String?getServletInfo();???????????????????????????????
????
public?abstract?void?destroy();????????????? //服務器移除servlet時,servlet釋放他所創(chuàng)建的系統(tǒng)資源(數(shù)據(jù)庫連接/后臺運行的線程/寫cookie)
}


表單數(shù)據(jù):
??????? 瀏覽器向服務器端發(fā)送的數(shù)據(jù)。對表單輸入的數(shù)據(jù),瀏覽器不做任何改動,當java的unioncode不能識別時,就出現(xiàn)了所謂的亂碼,所以我們就得采用某種方式對表單數(shù)據(jù)進行編碼,當傳回數(shù)據(jù)時在經(jīng)歷一次解碼。最后所有的表單數(shù)據(jù)都封裝在request對象里,通過request提供的方法獲得表單數(shù)據(jù)