我只是從Servlet開(kāi)始,并設(shè)法擁有一些Servlet,它們充當(dāng)單獨(dú)的URL,用于填充數(shù)據(jù)庫(kù)以進(jìn)行一些虛擬測(cè)試。形式的東西:public class Populate_ServletName extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); //Insert records //Print confirmation }}我有大約6個(gè)這樣的servlet,我想按順序執(zhí)行。我當(dāng)時(shí)在考慮使用setLocation設(shè)置要重定向的下一頁(yè),但不確定這是否正確,因?yàn)橹囟ㄏ驊?yīng)該在插入記錄后進(jìn)行。具體來(lái)說(shuō),我正在尋找這樣的東西:public class Populate_ALL extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); //Call Populate_1 //Call Populate_2 //Call Populate_3 //... }}有什么建議么?
如何依次執(zhí)行多個(gè)servlet?
鴻蒙傳說(shuō)
2019-11-04 10:41:35