国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

javaweb:運(yùn)行servlet顯示當(dāng)前時(shí)間3秒后跳轉(zhuǎn)其他頁(yè)面

2023-04-28 10:03 作者:huawei13Pro  | 我要投稿

來(lái)源我的學(xué)習(xí)筆記


這里的內(nèi)容自己設(shè)計(jì)

顯示頁(yè)面:我就放了一張圖片


servlet

代碼:

package servlet;


import java.io.IOException;

import java.io.PrintWriter;

import java.time.LocalTime;

import java.time.format.DateTimeFormatter;


import javax.servlet.DispatcherType;

import javax.servlet.RequestDispatcher;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;


/**

?* Servlet implementation class ShowTimeServlet

?*/

@WebServlet(name="showtimeservlet",urlPatterns = "/ShowTimeServlet")

public class ShowTimeServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

? ? ? ?

? ? /**

? ? ?* @see HttpServlet#HttpServlet()

? ? ?*/

? ? public ShowTimeServlet() {

? ? ? ? super();

? ? ? ? // TODO Auto-generated constructor stub

? ? }


/**

* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)

*/

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

// TODO Auto-generated method stub


response.setContentType("text/html;charset=UTF-8");//設(shè)置MIME內(nèi)容類型為text/html

response.setHeader("Refresh", "3;http://localhost:8080/demo0424/display01.jsp");//告訴瀏覽器3秒刷新頁(yè)面并且跳轉(zhuǎn)其他頁(yè)面

PrintWriter out=response.getWriter();//輸出流

LocalTime now=LocalTime.now();//獲取當(dāng)前時(shí)間

DateTimeFormatter format=DateTimeFormatter.ofPattern("hh:mm:ss");//格式化

String t=now.format(format);//轉(zhuǎn)換成字符串

out.println("<p>現(xiàn)在的時(shí)間是:"+t+"<p>");

out.println("<p>3秒后跳轉(zhuǎn)到顯示頁(yè)面<p>");


}


/**

* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)

*/

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

// TODO Auto-generated method stub


}


}


javaweb:運(yùn)行servlet顯示當(dāng)前時(shí)間3秒后跳轉(zhuǎn)其他頁(yè)面的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
工布江达县| 江都市| 白沙| 治多县| 科尔| 顺平县| 大连市| 依安县| 嵊州市| 四川省| 韩城市| 西乌| 南宁市| 永兴县| 衡阳县| 项城市| 建德市| 车致| 西贡区| 岑溪市| 万年县| 新巴尔虎右旗| 额济纳旗| 汉阴县| 承德市| 瑞丽市| 苍溪县| 咸丰县| 怀来县| 五大连池市| 行唐县| 武汉市| 镇宁| 伊宁县| 莱州市| 隆昌县| 宜川县| 六盘水市| 哈巴河县| 株洲县| 宜川县|